Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I want to use angular in an app except that angular is not loaded by default with the app. When a particular button is clicked, a new div is created and I want to use angular on that div.

I'm loading angular using yepnode as shown in the code below:

yepnope({
    test:window.angular,nope: ['/filesystem/content/js/angular.js'],
    complete: function(){ console.log('complete');}
});

Given that I've loaded angular and I have access to the div as $div, my next action will be

1. Create some html and use it as the innerHTML of $div
2. Create a controller (from another file eg /filesystem/controllers/abc.js
3. bind $div to controller and scope.

Not really sure how to proceed since in all my examples, I started with a page with angular loaded at started together with putting the ng-app tag on the html.

After loading angularjs, what are the next steps?

Thank you.

share|improve this question
1  
docs.angularjs.org/guide/bootstrap shows you how to do manual bootstrap. –  tosh shimayama Sep 10 '12 at 21:38
    
@toshshimayama: Exactly what I needed. Was able to bootstrap $div. Now looking at the controller. Can you post your comment as an answer so I accept it? Thanks. –  ritcoder Sep 11 '12 at 6:45
add comment

1 Answer

up vote 3 down vote accepted

Angularjs guide page would help you.

http://docs.angularjs.org/guide/bootstrap

There is a description how to do the manual bootstrapping.

share|improve this answer
    
Got it to work perfectly well with very little trouble. –  ritcoder Sep 11 '12 at 22:31
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.