我通过
现在我想使用Angular数据绑定,以便能够在这些较小的页面中显示动态内容。在我的主要Index.html页面中,我能够在第一个Div标签中声明ng-app没有问题。 angular.module也在该页面中声明。如果我将所有控制器逻辑放入主页面,我可以使绑定工作。
问题
我想要做的分割如下所示每个控制器脚本包含在导入的页面,而不只是在它的工作现在主要的index.html。
angular.module('ResultsApp', [])
.controller('CardsController', ['$scope',
function ($scope) {
$scope.results = {
'Passed': '12',
'Failed': '3',
'Warnings': '5',
'Summary': '20'
}
}
])
.controller('ResultsController', ['$scope',
function ($scope) {
$scope.results = [
{ Name: "The Name of something to display", Passed: "True", Failed: "False", Comments: "These are the comments yes! Comments" },
{ Name: "The Name of something to display", Passed: "True", Failed: "False", Comments: "These are the comments yes! Comments" },
{ Name: "The Name of something to display", Passed: "True", Failed: "False", Comments: "These are the comments yes! Comments" },
{ Name: "The Name of something to display", Passed: "True", Failed: "False", Comments: "These are the comments yes! Comments" },
{ Name: "The Name of something to display", Passed: "True", Failed: "False", Comments: "These are the comments yes! Comments" },
{ Name: "The Name of something to display", Passed: "True", Failed: "False", Comments: "These are the comments yes! Comments" },
{ Name: "The Name of something to display", Passed: "True", Failed: "False", Comments: "These are the comments yes! Comments" },
{ Name: "The Name of something to display", Passed: "True", Failed: "False", Comments: "These are the comments yes! Comments" }
];
}]);
我试着将控制器逻辑放入每个导入的页面,但它似乎不工作。我只是试图使用主页中定义的一个ng-app ...请指教。
好吧,如果我的代码移动到部分页面像这样,在TestResultsApp是主要的页面(索引)上称此页“pageheading.html”:
{{header.Title}}
angular.module('HeaderModule', ['TestResultsApp'])
.controller('HeaderController', ['$scope',
function ($scope) {
$scope.header = { "Title": "Pretty Good, Test Case Results Right here!" }
}])
新的错误 的部分页面,找不到角...更多关于这个明天...