Kne*_*ewB 4 angularjs angularjs-service
这段代码给了我Error: [$injector:unpr] Unknown provider: $scope, $locationProvider <- $scope, $location.
var app = angular.module('myApp.controllers', []);
app.controller('Signup', ['$scope, $location', function($scope, $location) {
$scope.checkEmailValid = function(){
//TODO make a decision about whether to go somewhere, if true do this:
$location.path('/view2');
};
}]);
Run Code Online (Sandbox Code Playgroud)
我错过了有关如何注入位置服务的内容吗?我没有配置$ locationProvider,但这样做似乎没有帮助.
你忘记了$ scope和$ location附近的报价:
var app = angular.module('myApp.controllers', []);
app.controller('Signup', ['$scope', '$location', function($scope, $location) {
$scope.checkEmailValid = function(){
//TODO make a decision about whether to go somewhere, if true do this:
$location.path('/view2');
};
}]);
Run Code Online (Sandbox Code Playgroud)
这应该是诀窍!
| 归档时间: |
|
| 查看次数: |
4925 次 |
| 最近记录: |