Skip to content

fix: changes to ui-sref in curly braces does not update $state.href #1449

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-ui-router",
"version": "0.2.13",
"version": "0.2.13-fix-ui-sref",
"main": "./release/angular-ui-router.js",
"dependencies": {
"angular": ">= 1.0.8"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "angular-ui-router",
"description": "State-based routing for AngularJS",
"version": "0.2.13",
"version": "0.2.13-fix-ui-sref",
"homepage": "http://angular-ui.github.com/",
"contributors": [
{
Expand Down
9 changes: 7 additions & 2 deletions release/angular-ui-router.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* State-based routing for AngularJS
* @version v0.2.13
* @version v0.2.13-fix-ui-sref-dev-2014-12-16
* @link http://angular-ui.github.com/
* @license MIT License, http://www.opensource.org/licenses/MIT
*/
Expand Down Expand Up @@ -4038,7 +4038,12 @@ function $StateRefDirective($state, $timeout) {
}
attrs.$set(attr, newHref);
};


attrs.$observe('uiSref', function(newv){
ref = parseStateRef(newv, $state.current.name);
update(scope.$eval(ref.paramExpr));
});

if (ref.paramExpr) {
scope.$watch(ref.paramExpr, function(newVal, oldVal) {
if (newVal !== params) update(newVal);
Expand Down
4 changes: 2 additions & 2 deletions release/angular-ui-router.min.js

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion src/stateDirectives.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,12 @@ function $StateRefDirective($state, $timeout) {
}
attrs.$set(attr, newHref);
};


attrs.$observe('uiSref', function(newv){
ref = parseStateRef(newv, $state.current.name);
update(scope.$eval(ref.paramExpr));
});

if (ref.paramExpr) {
scope.$watch(ref.paramExpr, function(newVal, oldVal) {
if (newVal !== params) update(newVal);
Expand Down