0

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!

Mar
  • 1,526
  • 6
  • 21
  • 46

1 Answers1

2

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.

lyschoening
  • 18,170
  • 11
  • 44
  • 54
  • A lot of useful info thnx! However; I added ngRoute module and route.min.js but still not working..I guess I read more.. – Mar Nov 07 '14 at 09:09
  • lots of things changed from 1.0.X to 1.2 1.3. Lots of module has been separated from core module. There is no longer any promise autoboxing ( compiler evaluation promises in scope when they resolve ). transclusion changed a LOT. This is no longer possible to have multiple scope ( aka isolated + non-isolated ) scopes on a dom element... and lot more. – Pierre Gayvallet Nov 07 '14 at 09:13
  • @PierreGayvallet yes, but OP asked about a specific application. – lyschoening Nov 07 '14 at 09:15
  • @PierreGayvallet agreed. And I assume the question will be deleted. – lyschoening Nov 07 '14 at 09:20