Skip to content

ref attribute #162

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
tamtakoe opened this issue Jun 4, 2013 · 8 comments
Closed

ref attribute #162

tamtakoe opened this issue Jun 4, 2013 · 8 comments

Comments

@tamtakoe
Copy link

tamtakoe commented Jun 4, 2013

Add, please, ref attribute for actions without changing address bar.

Usage:

<a ref="internal_url">Change state</a>

It is more simple and declarative then transitionTo()

@timkindberg
Copy link
Contributor

You can already use hrefs with urls pointing to state urls. Or a new feature we are working on is #139.

@tamtakoe
Copy link
Author

tamtakoe commented Jun 4, 2013

I use latest snapshot of library, and state index

<a href="state.index">Home</a> //doesn't work
<a href="$state.index">Home</a> //doesn't work
<a href="{{state.index}}">Home</a> //doesn't work
<a href="{{$state.index}}">Home</a> //doesn't work
<a href="{{$state.transitionTo('index')}}">Home</a> //doesn't work
<a href="" ui-state="index">Home</a> //doesn't work

@laurelnaiad
Copy link

Home should work.

@nateabele
Copy link
Contributor

I'll try to finish my work on the ui-sref directive this week. Mostly it just needs unit tests & a little bit of refactoring.

This message was hand-crafted for you on an Apple iPhone.

On Jun 4, 2013, at 8:44, Stu Salsbury [email protected] wrote:

Home should work.

Reply to this email directly or view it on GitHub.

@laurelnaiad
Copy link

Refactoring... ugh! :)

@tamtakoe
Copy link
Author

tamtakoe commented Jun 4, 2013

@stu-salsbury doesn't work: http://plnkr.co/edit/PDqOWK?p=preview
@nateabele it will be very great!

@laurelnaiad
Copy link

There were some issues with your plunker.
Bootstrap.js was throwing errors so I removed it. And I put $state on the $rootScope as the sample does, and took out some stray closing symbols.

    .controller('MainCtrl', ['$scope', '$state', function($scope, $state) {

      }])
    .run(
      [        '$rootScope', '$state', '$stateParams',
      function ($rootScope,   $state,   $stateParams) {
        $rootScope.$state = $state;
        $rootScope.$stateParams = $stateParams;
      }]);

try http://plnkr.co/edit/lM1C1h?p=preview

@tamtakoe
Copy link
Author

tamtakoe commented Jun 4, 2013

@stu-salsbury it work! Thank! I hope I can use ui-sref in production :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants