Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
fix($route): support inline annotation on .resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
mhevery committed Sep 12, 2012
1 parent 209b67d commit b0a05a7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/ng/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
8 changes: 4 additions & 4 deletions test/ng/routeSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
} });
});
Expand Down Expand Up @@ -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'});
Expand Down

4 comments on commit b0a05a7

@petebacondarwin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, you just beat me to it. Will this go into 1.1 or a 1.0.3 release?

@petebacondarwin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Find line 376, above, in your copy angular.js (I think it is line 7194) and change it yourself! Simple as that. Then you'll be able to use the inline array DI notation inside your resolves.
Pete

@vlamic
Copy link

@vlamic vlamic commented on b0a05a7 Nov 2, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petebacondarwin, we're using minified version of angular :)

@petebacondarwin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take a non-minified version - change it - minify it!

Please sign in to comment.