angular-routing

Angular 2 router auxiliary routes not working on redirectTo

試著忘記壹切 提交于 2019-11-29 15:09:10
I recently started a new project based on angular 2.0.0 in combination with Angular Router (V3.0.0). Thereby I have issues with the auxiliary routes. I want to split up my application in different views that appear in every state like navigation bar, main content, footer etc. So that when the user interact with the site only the part of the page that needs to be changed (f.e. the content) is changed and all other views are left as they are. Therefore I wanted to use the routers auxiliary feature as discussed in this talk: Angular Router Talk @AC2015 I set up my files as follows: app.html

Ionic 4 - how to pass data between pages using navCtrl or Router service

寵の児 提交于 2019-11-29 13:38:00
问题 In Ionic 3 you could use the second argument of the navController to pass data to the next page and retrieve it with the navParams service. This was a really convenient feature. Is there an equivalent api for routing in Ionic 4? You can always JSON.stringify the object/array to the routerParams, which in my opinion is less convenient. In Ionic 4 you can pass data with the modalController using ComponentProps and @Input() making it more suitable of a quick push/pop implementation. EDIT My

Get route parameters in component

旧时模样 提交于 2019-11-29 11:15:16
I am working on the Angular-6 project. I have many child routes for my application. One of them is as follow: const routes: Routes = [ { path: 'innovation-track/:innovation-track-id', component: InnovationTrackComponent, children: [ { path: 'sprint', component: ScrumBoardComponent } ] } ]; I want to get innovation-track-id value from URL in my ScrumBoardComponent . I know I can get this by doing following: constructor(private _route: ActivatedRoute) { } //somewhere in method this._route.snapshot.parent.paramMap But, I want to fetch innovation-track-id value in any component, doesn't matter if

Angular 5 - load modules (that are not known at compile time) dynamically at run-time

橙三吉。 提交于 2019-11-29 09:41:22
问题 Is it possible for Angular 5 to load modules/components that are not known at compile time, but during runtime dynamically? I guess this won't work using webpack but maybe using system.js? EDIT: The whole idea is to build a plugin based application where individual plugins are dropped inside a plugin folder, angular will pick it automatically, without having to recompile and deploy the whole angular app. Where plugins are separate pieces of functionalities. Of course there are routes

Partial views in AngularJS

只谈情不闲聊 提交于 2019-11-29 09:21:00
I'm new to Angular and would appreciate any advice. Basically, I have one-to-many relationship- one Category has several Product , I have the layout page where I render different partial views: <div class="mainContent"> <ng-view></ng-view> </div> My first view shows the list of categories, when one of them is clicked, I show the second view, which is separated to two parts: list of categories, and list of products of particular category, schematically it looks like: My problem is that I cannot figure out how to use another partial for the list of products because want to keep them in separate

Pass object as parameter in $state.go

廉价感情. 提交于 2019-11-29 03:05:28
I want to navigate to another state/screen and pass a simple json object to this next screen. I have the following: var benefit = { "x": "y"}; $state.go('pages.claimed', { 'benefit': benefit }); My state looks like this: .state('pages.claimed', { url: '/claimed', views: { 'page': { templateUrl: 'templates/pages/claimed.html' } } }) I can't however access the "benefit" object/parameter in the pages.claimed view. I'm using the ionic framework based on angular. Thanks for pointing me in the right direction! Umidbek Karimov Parse object to json: var benefit = angular.toJson({ "x": "y"}); Define

Angular2 - APP_BASE_HREF with HashLocationStrategy

 ̄綄美尐妖づ 提交于 2019-11-29 02:22:33
I have an angular application uses routing with HashLocationStrategy, I need to set different value in main html file and different in routing. I tried this solution: @NgModule({ imports: [ BrowserModule, FormsModule, HttpModule, MyRouting // with useHash set to true ], declarations: [ AppComponent, ], providers: [ { provide: APP_BASE_HREF, useValue: '/prefix' } ], bootstrap: [AppComponent] }) export class AppModule { } Works almost well but value '/prefix' is insert after hash, like this: http://myapp.com/#/prefix/home Whereas i want: http://myapp.com/prefix/#/home For clarity, my base tag is

Angularjs dependency injection in resolve

狂风中的少年 提交于 2019-11-29 00:46:37
问题 I would like to use proper dependency injection in MyCtrl1 to inject the fields of the MyCtrl1.resolve object. I've tried many different combinations of attempting to inject @MyCtrl1.resolve etc. with no luck. @MyCtrl1 = ($scope, $http, batman, title) -> $scope.batman = batman.data $scope.title = title.data @MyCtrl1.resolve = { batman: ($http) -> $http.get('batman.json') title: ($http) -> $http.get('title.json') } #@MyCtrl1.$inject = ['$scope', '$http'] -- commented out because not sure how

Custom RouteReuseStrategy for Angular's child module

故事扮演 提交于 2019-11-29 00:29:45
I want to use this custom route reuse strategy for just one module: export class CustomRouteReuseStrategy extends RouteReuseStrategy { public shouldDetach(route: ActivatedRouteSnapshot): boolean { return false; } public store(route: ActivatedRouteSnapshot, detachedTree: DetachedRouteHandle): void {} public shouldAttach(route: ActivatedRouteSnapshot): boolean { return false; } public retrieve(route: ActivatedRouteSnapshot): DetachedRouteHandle { return null; } public shouldReuseRoute(future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean { return true; } } So I've passed into

state provider and route provider in angularJS

我是研究僧i 提交于 2019-11-28 23:21:36
Below is my app.js file angular .module('repoApp', [ 'ngAnimate', 'ngAria', 'ngCookies', 'ngMessages', 'ngResource', 'ngRoute', 'ngSanitize', 'ngTouch', 'ui.bootstrap', 'ui.router' ]) .config(function ($routeProvider) { $routeProvider .when('/', { templateUrl: 'views/main.html', controller: 'MainCtrl' }) .when('/about', { templateUrl: 'views/about.html', controller: 'AboutCtrl' }) .when('/login', { templateUrl: 'views/loginPage.html', controller: 'loginCtrl' }) .otherwise({ redirectTo: '/' }); }); angular .module('loginState',['ui.router']); Below is my states file angular .module('repoApp')