Answer the question
In order to leave comments, you need to log in
Why does Error: ng:areq Bad Argument(routing, controller not visible) occur?
Hello, here is the routing code
.when('/',{
templateUrl: 'template/main.html'
})
.when('/phones/:phoneId',{
templateUrl: 'template/phone.html',
controller: 'PhoneCntrl'
})
.otherwise({redirectTo:'/'})
app.controller('PhoneCntrl','$routeParams', function($scope, $routeParams){
$http.get('phones/' + $routeParams.phoneId + '.json').success(function(data) {
$scope.phone = data;
});
$scope.phoneId = $routeParams.phoneId;
});
<a ng-href="#/phones/{{phone.id}}" class="btn btn-primary">Show</a>
<h1>Тест</h1>
{{phone.phoneId}}
Only the word "Test" is displayed, and the error in the console is Error: ng:areq Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question