在这段代码中,控制器正在提供注入范围和rootScope,那么为什么它在最后一行失败:
ReferenceError:$ rootscope未定义
angular.module("myEntity").controller('productsCtrl', [
'$scope', 'MyAction', '$rootScope', function ($scope, MyAction, $rootScope) {
$scope.propertyValue = something;
$scope.canDoSomething = $rootscope.myRootScopeProperty = 1;
....
答案 0 :(得分:4)
只需转换此
$rootscope
到这个
$rootScope
答案 1 :(得分:1)
将$rootscope
更改为$rootScope
答案 2 :(得分:0)
这里的错误是$ rootscope,所以我们需要将它改为$ rootScope。,
<强>问题:强>
$scope.canDoSomething = $rootscope.myRootScopeProperty = 1;
ReferenceError:$ rootscope未定义
<强>溶液强>
$scope.canDoSomething = $rootScope.myRootScopeProperty = 1;