-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Change anchor hrefs to ui-sref when using ui-router #331
Comments
Is it all href or just the ng-href? All ng-href are in the navbar files. |
The navbar uses href, not ng-href. I find myself changing this to ui-sref in order to properly navigate to the desired $state. Also, when logging in, login.controller calls '$location.path('/')'. I think if using ui-router, this should be something like $state.go('main') instead. |
I don't understand. I went through the generator and just found this:
|
Ok, so ng-href is only for $scope.menu in navbar.controllers. The rest of the menu li's use href. I think they both should be ui-sref if using ui-router. For example, I changed ng-href to ui-sref="main" for "Home", and obviously all the other hrefs as well (to their proper states). |
To avoid such code in several place all over the files:
they may be better to write separate files for ui-router:
and also the four associated jade file. In following files:
|
Changes: - Use `ui-sref` instead of `href` or `ng-href` when ui-router is chosen - Use `ui-sref-active` instead of `ng-class='{active: isActive()}'` when ui-router is chosen - Use `$state.go()` where applicable, when ui-router is chosen - Use `$scope.menu[n].state` instead of `$scope.menu[n].link` when ui-router is chosen (attempt to remove possible confusion) - Omit `$scope.isActive` when ui-router is chosen - Simplify `navbar(jade).jade` templating (remove extra `<% if (filters.auth) %>` tag) - Add `/logout` route for both ng-route and ui-router - Use `$routeChangeStart` or `$stateChangeStart` to pass refering route or state to `/logout` - Add `stateMock` for testing `$state` transitions - Use `stateMock` in main.controller for expecting template requests from state transistions Closes angular-fullstack#331
Changes: - Use `ui-sref` instead of `href` or `ng-href` when ui-router is chosen - Use `ui-sref-active` instead of `ng-class='{active: isActive()}'` when ui-router is chosen - Use `$state.go()` where applicable, when ui-router is chosen - Use `$scope.menu[n].state` instead of `$scope.menu[n].link` when ui-router is chosen (attempt to remove possible confusion) - Omit `$scope.isActive` when ui-router is chosen - Simplify `navbar(jade).jade` templating (remove extra `<% if (filters.auth) %>` tag) - Add `/logout` route for both ng-route and ui-router - Use `$routeChangeStart` or `$stateChangeStart` to pass refering route or state to `/logout` - Add `stateMock` for testing `$state` transitions - Use `stateMock` in main.controller for expecting template requests from state transistions Closes #331
When spinning up a new app w/ ui-router, I find myself having to find and change each href to ui-sref. Would be preferable to have this automatically set when using the ui-router option.
The text was updated successfully, but these errors were encountered: