Reputation: 1606
I built a simple app with angular 1.0.7 I realized that I was using old version and I wanted to change the version to latest: 1.2 or 1.3 however then my app doesn't work..
How do I know which feature is not supported or what I have to change?
App:
var sampleApp = angular.module('sampleApp', []);
sampleApp.config(['$routeProvider',
function($routeProvider) {
$routeProvider.
when('/ShowOrder/:carId', {
templateUrl: 'templates/show_order.html',
controller: 'ShowOrderController'
}).
when('/ShowCarOrder', {
templateUrl: 'templates/list.html',
controller: 'showCarsCtrl'
});
}]);
sampleApp.controller('ShowOrderController', function($scope, $http, $routeParams) {
$http.get('data.json').
success(function(data){
$scope.cars = data;
$scope.car_id = $routeParams.carId;
});
});
sampleApp.controller('showCarsCtrl', function($scope, $http ) {
$http.get('data.json').
success(function(data){
$scope.cars = data;
});
});
Live: http://plnkr.co/edit/JpL8gmMJ2hsZistfNoCl?p=preview
Thanks in advance!
Upvotes: 0
Views: 3257
Reputation: 18738
The router has been moved into its own ngRoute
route package in Angular 1.2. You need to import that package to make your code work. See the Plunker here.
A note for future debugging: You can diagnose errors like these by following the error messages in the developer console. In this particular case, had you simply clicked the link in the error message you would have been redirected to a page that would have told you what to do.
Upvotes: 2