javascript - AngularJS路由添加controller问题
PHP中文网
PHP中文网 2017-04-10 17:18:05
0
2
545

我在使用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>
PHP中文网
PHP中文网

认证0级讲师

reply all(2)
左手右手慢动作

你的 $scope 单词写错了 , 自己找...

Peter_Zhu

scope 拼成了scoep

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!