javascript - AngularJS路由添加controller问题
本文介绍了javascript - AngularJS路由添加controller问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
我在使用angularjs路由中,想要将在路由创建controller,然后为页面赋值,但是报错说 ReferenceError: $scoep is not defined,但我不知道哪里出问题了,还请帮我只小白分析分析。
我的代码如下:
userApp.config(function($routeProvider){
$routeProvider.when('/',{templateUrl:'views/userViews/homeUserView.html'})
.when('/app',{templateUrl:'views/userViews/application.html'})
.when('/work',{
templateUrl:'views/userViews/work.html',
controller:'jobCtrl'
controller:function($scope){
$scope.op_object = "作业";
$scoep.Lists = [
{
'id':'1',
'name':'作业1',
'info':'这是作业1的描述啦'
},
{
'id':'2',
'name':'作业2',
'info':'这是作业2的描述啦'
},
{
'id':'2',
'name':'作业2',
'info':'这是作业2的描述啦'
}
];
}
});
我在页面上想获取这里的op_object和Lists显示在页面上,代码如下:
<tr ng-repeat="list in Lists">
<td><input type="checkbox"></td>
<td ng-bind="list.id"></td>
<td ng-bind="list.name"></td>
<td ng-bind="list.info"></td>
<td><i class="icon-pencil yellow_icon"></i></td>
<td><i class="icon-gear blue_icon"></i></td>
<td><i class="icon-remove red_icon"></i></td>
</tr>
解决方案
你的 $scope 单词写错了 , 自己找...
这篇关于javascript - AngularJS路由添加controller问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文