Skip to content

Commit 5e11cb6

Browse files
committed
Fix injection of locals for 'resolve' functions (see #31)
1 parent 6b39f5d commit 5e11cb6

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

build/angular-ui-states.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* State-based routing for AngularJS
3-
* @version v0.0.1 - 2013-02-17
3+
* @version v0.0.1 - 2013-02-25
44
* @link
55
* @license MIT License, http://www.opensource.org/licenses/MIT
66
*/
@@ -366,14 +366,14 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) {
366366
var locals = { $stateParams: $stateParams };
367367
forEach(state.params, function (name) {
368368
var value = params[name];
369-
$stateParams[name] = (params[name] != null) ? String(value) : null;
369+
$stateParams[name] = (value != null) ? String(value) : null;
370370
});
371371

372372
// Resolves the values from an individual 'resolve' dependency spec
373373
function resolve(deps, dst) {
374374
forEach(deps, function (value, key) {
375375
promises.push($q
376-
.when(isString(value) ? $injector.get(value) : $injector.invoke(value, locals))
376+
.when(isString(value) ? $injector.get(value) : $injector.invoke(value, state.self, locals))
377377
.then(function (result) {
378378
dst[key] = result;
379379
}));
@@ -600,7 +600,7 @@ function UrlMatcher(pattern) {
600600
// The number of segments is always 1 more than the number of parameters.
601601
var id, regexp, segment;
602602
while ((m = placeholder.exec(pattern))) {
603-
id = m[1] || m[2];
603+
id = m[1] || m[2]; // IE[78] returns '' for unmatched groups instead of null
604604
regexp = m[3] || '[^/]*';
605605
segment = pattern.substring(last, m.index);
606606
if (segment.indexOf('?') >= 0) break; // we're into the search part

0 commit comments

Comments
 (0)