Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

I'm working in a web, I need to load my div content using this jQuery function: $('#mainPage').load($(this).attr('mainContent'));

In my index.php I have configured the directive ng-app=".MyApp" and also I'm using ng-controllers there and it works fine, but using some ng-controllers inside the loaded page in the #mainPage div it doesn't works fine, as a solution I have tryied:

angular.element(document).ready(function() {
             angular.bootstrap(document, ['MyApp']);
           });

and it loads correctly and then the controller is working fine, but if I load again the div space then Angular crash with the error:

Error: [ng:btstrpd] http://errors.angularjs.org/1.4.3/ng/btstrpd?p0=....

(that means angular is bootstapped)

I can't load the div's content using ng-includes directive because I shoud use jquery and javascript inside the loaded page, then I don't know how to solve this problem...

Thanks very much!!!

share|improve this question
    
If you are bootstrapping your application manually then you don't need to use ng-app=".MyApp" on page – Pankaj Parkar 2 hours ago
    
why aren't you using angular methodology to load html into view instead of using $().load()? – charlietfl 2 hours ago
    
For the first answer: Also using the bootstrapping manually in the index.html, I can't use the controller in the loaded php file in the #mainPage div My intention is load authomatically or manually the bootstrap and be able to use the controller in the loaded php file inside the div – user2098322 29 mins ago
    
For the second answer: I can't use the angular methodology to load the php file because inside them I need to use jQuery and javascript libraries, and using angular ng-include, the javascript doesn't works Thankssss – user2098322 28 mins ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.