Skip to content

Commit

Permalink
#128 Providing a prober params object even for states that does not h…
Browse files Browse the repository at this point in the history
…ave a route to extract params from...
  • Loading branch information
jeme committed Mar 8, 2015
1 parent 44a97ef commit 8e44561
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 5 deletions.
23 changes: 22 additions & 1 deletion build/angular-routing.js
Original file line number Diff line number Diff line change
Expand Up @@ -3198,6 +3198,27 @@ var $ScrollProvider = [function () {
}];
}];
angular.module('dotjem.routing').provider('$scroll', $ScrollProvider);
//scroll.$register = register;
//var elements = {};
//function register(name: string, elm: HTMLElement) {
// if (name in elements) {
// var existing = elements[name];
// }
// elements[name] = elm;
//}
/****jQuery( "[attribute='value']"
* scrollTo: top - scroll to top, explicitly stated.
* (This also enables one to override another scrollTo from a parent)
* scrollTo: null - don't scroll, not even to top.
* scrollTo: element-selector - scroll to an element id
* scrollTo: ['$stateParams', function($stateParams) { return stateParams.section; }
* - scroll to element with id or view if starts with @
*/
//scrollTo: top - scroll to top, explicitly stated.(This also enables one to override another scrollTo from a parent)
//scrollTo: null - don't scroll, not even to top.
//scrollTo: @viewname - scroll to a view.
//scrollTo: elementid - scroll to an element id
//scrollTo: ['$stateParams', function($stateParams) { return stateParams.section; } - scroll to element with id or view if starts with @

/// <reference path="refs.d.ts" />

Expand Down Expand Up @@ -3635,7 +3656,7 @@ var StateComparer = (function () {
};

StateComparer.prototype.extractParams = function (params, current) {
var paramsObj = {};
var paramsObj = buildParams();
if (current.route) {
forEach(current.route.params, function (param, name) {
paramsObj[name] = params[name];
Expand Down
2 changes: 1 addition & 1 deletion build/angular-routing.min.js

Large diffs are not rendered by default.

23 changes: 22 additions & 1 deletion gh-pages/assets/scripts/angular-routing/impl/angular-routing.js
Original file line number Diff line number Diff line change
Expand Up @@ -3198,6 +3198,27 @@ var $ScrollProvider = [function () {
}];
}];
angular.module('dotjem.routing').provider('$scroll', $ScrollProvider);
//scroll.$register = register;
//var elements = {};
//function register(name: string, elm: HTMLElement) {
// if (name in elements) {
// var existing = elements[name];
// }
// elements[name] = elm;
//}
/****jQuery( "[attribute='value']"
* scrollTo: top - scroll to top, explicitly stated.
* (This also enables one to override another scrollTo from a parent)
* scrollTo: null - don't scroll, not even to top.
* scrollTo: element-selector - scroll to an element id
* scrollTo: ['$stateParams', function($stateParams) { return stateParams.section; }
* - scroll to element with id or view if starts with @
*/
//scrollTo: top - scroll to top, explicitly stated.(This also enables one to override another scrollTo from a parent)
//scrollTo: null - don't scroll, not even to top.
//scrollTo: @viewname - scroll to a view.
//scrollTo: elementid - scroll to an element id
//scrollTo: ['$stateParams', function($stateParams) { return stateParams.section; } - scroll to element with id or view if starts with @

/// <reference path="refs.d.ts" />

Expand Down Expand Up @@ -3635,7 +3656,7 @@ var StateComparer = (function () {
};

StateComparer.prototype.extractParams = function (params, current) {
var paramsObj = {};
var paramsObj = buildParams();
if (current.route) {
forEach(current.route.params, function (param, name) {
paramsObj[name] = params[name];
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/state/stateComparer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class StateComparer {
}

public extractParams(params, current) {
var paramsObj = {};
var paramsObj = buildParams();
if (current.route) {
forEach(current.route.params, (param, name) => {
paramsObj[name] = params[name];
Expand Down
4 changes: 4 additions & 0 deletions test/state/stateComparerSpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,4 +230,8 @@ describe('state.stateComparer', function () {
expect(result.unchanged[0]).toHaveProperties({ active: true, changed: false, name: '$root.branch', isLeaf: true });
});
});




});

0 comments on commit 8e44561

Please sign in to comment.