gpt4 book ai didi

angularjs - Controller :ctrlfmt Badly formed controller string '' . 必须匹配 `__name__ as __id__` 或 `__name__`

转载 作者:行者123 更新时间:2023-12-05 00:54:41 27 4
gpt4 key购买 nike

在 rootes.js 中

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

Controller
.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



有一个 Controller 名称为空的 div
<div ng-controller="">
..
</div>

因此它显示

Badly formed controller

关于angularjs - Controller :ctrlfmt Badly formed controller string '' . 必须匹配 `__name__ as __id__` 或 `__name__`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39633425/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com