angular-ui-router

mdNavBar doesn't update from URL with Angular 1.6 and ui-router 1.0.0-rc.1

梦想的初衷 提交于 2019-12-11 06:28:05
问题 I'm using Angular 1.6 and ui-router 1.0.0-rc.1. I set up a couple of simple states: .config(function($stateProvider) { $stateProvider.state({ name: "foo", url: "/foo", template: "<foo-widget layout='row'/>" }); $stateProvider.state({ name: "bar", url: "/bar", template: "<bar-widget layout='row'/>" }); $stateProvider.state({ name: "home", url: "", template: "<foo-widget layout='row'/>" }); Then on the main page I put an mdNavBar: <md-nav-bar nav-bar-aria-label="navigation links" md-selected

HTML5 pushState Clash w/Angular UI-Router URL Routing

前提是你 提交于 2019-12-11 06:17:15
问题 I have an Angular.js webapp that employs ui-router (https://github.com/angular-ui/ui-router) w/parallel named views like such: .state( 'app.experience', { url: 'e/:experienceId', views: { 'center-pane@': { templateUrl: 'partials/experience.html', controller: 'ExperienceController' } }) I enabled HTML5 pushState via $locationProvider.html5Mode(true); When http://www.mysite.com/e/123 is requested, my backend sends back the index.html at the root directory. (as per Using HTML5 pushstate on

404 page in angular ui-router

微笑、不失礼 提交于 2019-12-11 06:08:48
问题 I am using ui-router in an angular single page application. I have some routes defined, and I have a specific 404 route like this: app.config(function($urlRouterProvider, $stateProvider){ $urlProvider.otherwise('404') $stateProvider .state('example', { url: '/example/:id', templateUrl: 'example.html', controller: 'ExampleController' }) .state('404', { url: '*path', templateUrl: '404.html' }) }) Notice how the url for 404 state is '*path', which means it will match any path. I made it so if

How to use component templates with ui-router AngularJS?

时光总嘲笑我的痴心妄想 提交于 2019-12-11 06:08:15
问题 I am experiencing problems with ui-router. If I change from template to component suddenly all routing breaks. app.module.js: (function(){ angular.module('jigup', [ 'ui.router', 'map', ]); })(); app.config.js (function(){ angular .module('jigup') .config(function($stateProvider, $urlRouterProvider) { $urlRouterProvider.when("", "/map"); $stateProvider .state("map", { url: "/map", template: '<span style="width:100px" ui-sref="map"><a href="">map</a></span><span style="width:100px" ui-sref="

AngularJS change single URL parameter on load if it matches a value

血红的双手。 提交于 2019-12-11 06:04:35
问题 I'm working on a web app where parameters get passed to views as you navigate through the site. These parameters are set by user filters. I've hit a problem whereby some views don't support a specific value from one of the filters, and where this happens the parameter needs to be reset to one out of two possibilities. I've been using $location.search({ type: "blue" }) but I've realised that if there are other parameters in the url/on the view, these get removed in place for just the one that

Reload not working when passing multiple params in ui-router state

风格不统一 提交于 2019-12-11 06:02:46
问题 I am using ui-router with parent and child states. My states are defined as below : .state("home.ben", { url: "/beneficiary/:name", abstract:true, templateUrl: "app/ben/views/ben-form.html", controller: "BeneficiaryFormController", controllerAs: "bfCtrl", params : {id:'',name:''},... .state("home.ben.general", { url: "/", templateUrl: "app/ben/views/partials/general.html", controller: "BeneficiaryGeneralController", controllerAs: "bGenCtrl", params:{id:'',name:''}, ncyBreadcrumb: { label:

Legacy Meteor Methods angular2 UI Router Issue

偶尔善良 提交于 2019-12-11 05:51:16
问题 https://github.com/faizmh/meteor_angular2_router_issues I am trying to navigate from home page to market page. In home page, I tried different variations to transition to market page My target market page, reads from the db using Meteor RPC method via Observables In the case of legacy accounts package and meteor methods, the angular UI fails to render the data home.component.html home page <a [routerLink]="['/market']"> Market</a> <button (click)="direct()">Direct Router</button> <button

How to inject a service in CustomReuseStrategy in angular?

放肆的年华 提交于 2019-12-11 05:46:58
问题 I have implemented CustomReuseStrategy in Angular. I want to subscribe to an observable in shouldAttach() to determine if the route should be reattached or not. I have created an observable in a service and I need to use the service instance in CustomReuseStrategy. I tried injecting the service in the constructor and I get this error: Can't resolve all parameters for CustomReuseStrategy Should the constructor for the RouteReuseStrategy not have parameters? If so, how do I create the instance

Angular 4 unit test - Cannot read property 'root' of undefined

谁说胖子不能爱 提交于 2019-12-11 05:44:43
问题 I've got a problem with my unit test. I don't know what's wrong with this test. I've searched a soulations but nothing works for me. When I want to mock Router I have an error TypeError: Cannot read property 'root' of undefined . Thanks in advace for any help. Error: TypeError: Cannot read property 'root' of undefined at rootRoute (webpack:///~/@angular/router/@angular/router.es5.js:5880:0 <- src/test.ts:53760:30) at DynamicTestModuleInjector.get (ng:///DynamicTestModule/module.ngfactory.js

Anglularjs passing value from Controller, State Resolve and Factory Service

心不动则不痛 提交于 2019-12-11 05:39:08
问题 Okay, I have three relevant files for my question/s.. App.js - app.config In my app.config passing value in the resolve using $stateParams is possible and I attain it. But how about the value is from the controller ? I need the provCode value to use it in my php select query . .state("editStudent", { abstract: true, url:"/student/:id", controller: "EditStudentController", templateUrl: "views/students/editStudent.html", resolve: { dataservice: 'dataservice', student: function(dataservice,