mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-18 15:50:22 +00:00
Previously one had to write:
$routeProvider.when('/foo', {...});
$routeProvider.when('/bar', {...});
$routeProvider.otherwise({...});
After this change it's just:
$routeProvider.
when('/foo', {...}).
when('/bar', {...}).
otherwise({...});
Breaks #when which used to return the route definition object but now
returns self. Returning the route definition object is not very useful
so its likely that nobody ever used it.
20 lines
589 B
JavaScript
20 lines
589 B
JavaScript
'use strict';
|
|
|
|
describe('$routeParams', function() {
|
|
it('should publish the params into a service', function() {
|
|
module(function($routeProvider) {
|
|
$routeProvider.when('/foo', {});
|
|
$routeProvider.when('/bar/:barId', {});
|
|
});
|
|
|
|
inject(function($rootScope, $route, $location, $routeParams) {
|
|
$location.path('/foo').search('a=b');
|
|
$rootScope.$digest();
|
|
expect($routeParams).toEqual({a:'b'});
|
|
|
|
$location.path('/bar/123').search('x=abc');
|
|
$rootScope.$digest();
|
|
expect($routeParams).toEqual({barId:'123', x:'abc'});
|
|
});
|
|
});
|
|
});
|