0

My issue is that after changing views using routing, the jquery components in my page doesn´t get rendered. I have customized ui components like dropdowns that are not being processed. I saw this answer: Angular.js App with routing.. Cannot get jquery ui layout plugin working on 2nd view

But I can´t figure out how to make it work in my case. It seems that when angular renders the template, any but angularjs code is processed.

Thanks so much in advance.

Code: http://plnkr.co/1mwMcsqMxWGTheoQmJ22

2
  • Hey you'll need to post some code or a jsfiddle before anyone can offer any understanding of your problem Commented Sep 19, 2013 at 19:35
  • Plunker with example added Commented Sep 19, 2013 at 20:27

1 Answer 1

1

In the example you've provided, you're not actually loading the file with the jQuery code in it (jqcode.js).

The real problem however, as you can see in this version of your example, is that the document ready event is executed before your template has been loaded and rendered. This means that the element your jQuery code is attempting to target does't exist when you try to manipulate it.

You should really look into Angular directives which is where you are advised to place any DOM manipulation logic within an Angular project:

If you have to perform your own manual DOM manipulation, encapsulate the presentation logic in directives.

From the Angular documentation for controllers.

Sign up to request clarification or add additional context in comments.

1 Comment

Hey, thanks so much for your answer, I think that I've solved my issue and it's working now. Code attached. I'm using a directive with "M" restriction, to initialize a bunch of a stuff by executing the directive only once. (In the example it's just a text by in my app will be ten dropdowns..) Plunker: plnkr.co/5qZbyon9JbUy9pUmaAp6

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.