3

我想在应用程序中使用 angular,但应用程序默认不加载 angular。单击特定按钮时,会创建一个新 div,我想在该 div 上使用 angular。

我正在使用 yepnode 加载角度,如下面的代码所示:

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

鉴于我已经加载了 angular 并且可以将 div 作为 $div 访问,我的下一个操作将是

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.

不太确定如何继续,因为在我的所有示例中,我从一个加载了角度的页面开始,并将 ng-app 标记放在 html 上。

加载 angularjs 之后,接下来的步骤是什么?

谢谢你。

4

1 回答 1

7

Angularjs 指南页面将为您提供帮助。

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

有一个描述如何进行手动引导。

于 2012-09-11T07:53:04.970 回答