fix($route): support inline annotation on .resolve

This commit is contained in:
Misko Hevery 2012-09-11 22:10:26 -07:00
parent 209b67df6a
commit b0a05a7531
2 changed files with 5 additions and 5 deletions

View file

@ -373,7 +373,7 @@ function $RouteProvider(){
forEach(next.resolve || {}, function(value, key) {
keys.push(key);
values.push(isFunction(value) ? $injector.invoke(value) : $injector.get(value));
values.push(isString(value) ? $injector.get(value) : $injector.invoke(value));
});
if (isDefined(template = next.template)) {
} else if (isDefined(template = next.templateUrl)) {

View file

@ -232,10 +232,10 @@ describe('$route', function() {
return deferB.promise;
});
$routeProvider.when('/path', { templateUrl: 'foo.html', resolve: {
a: function($q) {
a: ['$q', function($q) {
deferA = $q.defer();
return deferA.promise;
},
}],
b: 'b'
} });
});
@ -434,8 +434,8 @@ describe('$route', function() {
});
});
});
it('should match route with and without trailing slash', function() {
module(function($routeProvider){
$routeProvider.when('/foo', {templateUrl: 'foo.html'});