我需要使用angular.js动态包含javascript文件。假设我有下面的项目html视图结构。如何使用angular.js包含.js文件
1-index.html.
a)hod.html-hodcontroller.js
i)home.html.-homecontroller.js
ii)about.html.-aboutcontroller.js
b)Princpal.html-princpalcontroller.js
i)home.html-homecontroller.js
ii)about.html -aboutcontroller.js
让我来解释一下上面的结构。我有一个母版页(i.e-index.html
)。 hod.html and Princpal.html
是index.html页面的局部视图。每个home.html and about.html
都是hod.htmland Princpal.html
的局部视图,所以最后这些都是嵌套视图。在这里我包括所有js文件在index.html
页但是在这里我需要任何部分视图将附加在索引页中只有相关的.js文件将附加在索引页面不是所有页面。所以请帮助我使用angular.js来做到这一点。
请查看'ui-router'与角度中的嵌套视图有关以及SPA中应如何实现。回顾'ng-include'和指令的概念,特别是在加载部分视图方面,我认为这会对你有所帮助。 – markyph
@markyph:我也在使用ui-router。你可以根据这个要求编辑一个例子。 – subhra