html5 绑定,HTML5导入和角控制器绑定

我通过

现在我想使用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!" }

}])

新的错误 的部分页面,找不到角...更多关于这个明天...

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值