加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

angularjs – controller:ctrlfmt糟糕的控制器字符串”.必须匹

发布时间:2020-12-17 17:26:55 所属栏目:安全 来源:网络整理
导读:在rootes.js中 .state('main.mydata',{ url: '/my-data',templateUrl: '/app/views/pages/my-data.html',controller: 'mydataCtrl'}) 调节器 .controller('mydataCtrl',['$scope','$state','$http',function($scope,$state,$http) { console.log("Came to My
在rootes.js中

.state('main.mydata',{
    url: '/my-data',templateUrl: '/app/views/pages/my-data.html',controller: 'mydataCtrl'
})

调节器

.controller('mydataCtrl',['$scope','$state','$http',function($scope,$state,$http) {
    console.log("Came to My Data")
}])

当我在控制台中调用页面时出错

Error: angular.js?bundleVirtualPath=~%2fbundles%2fangular:13708 [$controller:ctrlfmt] Badly formed controller string ''. Must match `__name__ as __id__` or `__name__`.
http://errors.angularjs.org/1.5.7/$controller/ctrlfmt?p0=
    at http://localhost:25282/Scripts/angular.js?bundleVirtualPath=%7eNaNbundles%fangular:68:12
    at $controller (http://localhost:25282/Scripts/angular.js?bundleVirtualPath=%7e%fbundles%fangular:10199:17)
    at setupControllers (http://localhost:25282/Scripts/angular.js?bundleVirtualPath=%7e%fbundles%fangular:9331:34)
    at nodeLinkFn (http://localhost:25282/Scripts/angular.js?bundleVirtualPath=%7e%fbundles%fangular:9116:32)
    at compositeLinkFn (http://localhost:25282/Scripts/angular.js?bundleVirtualPath=%7e%fbundles%fangular:8510:13)
    at nodeLinkFn (http://localhost:25282/Scripts/angular.js?bundleVirtualPath=%7e%fbundles%fangular:9210:24)
    at compositeLinkFn (http://localhost:25282/Scripts/angular.js?bundleVirtualPath=%7e%fbundles%fangular:8510:13)
    at compositeLinkFn (http://localhost:25282/Scripts/angular.js?bundleVirtualPath=%7e%fbundles%fangular:8513:13)
    at compositeLinkFn (http://localhost:25282/Scripts/angular.js?bundleVirtualPath=%7e%fbundles%fangular:8513:13)
    at publicLinkFn (http://localhost:25282/Scripts/angular.js?bundleVirtualPath=%7e%fbundles%fangular:8390:30)

可能是什么问题?

解决方法

在页面中

my-data.html

div有空控制器名称

<div ng-controller="">
  ..
</div>

因为它显示了

Badly formed controller

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读