mercredi 20 septembre 2017

How to get an DOM element outside of ember view?

I am currently working on an application where we are mopving the whole application to ember,but as of now the application is working with JSP and jquery.

My problem is that my ember app is currently getting inserted into a jsp page via an object tag.now i want to know the class of this tag and render the route accordingly.

When i tried fo find $('object'),i am getting nothing.

I tried few other options available but no luck.

My index route is loading home route as of now but i want to load routes on the basis of class available on object tag.

below is my index.js

import Ember from 'ember';

    export default Ember.Route.extend({
        beforeModel() {
        console.log(this);
        this.replaceWith('rentals');
      }
    });

and my jsp has this code snippet in order to add my desired ember application

var url = "../../rdm/ember/dist/index.html";
                if(page = "user")
                {
                    $(".ui-layout-center").html( '<object type="text/html" class="user"></object>');
                    $("object").attr('data',url);
                    mdmCurrentRequestObj = $(".ui-layout-center object");   
                }
                else
                {
                    $(".ui-layout-center").html( '<object type="text/html" class="userprofile"></object>');
                    $("object").attr('data',url);
                    mdmCurrentRequestObj = $(".ui-layout-center object");       
                }




Aucun commentaire:

Enregistrer un commentaire