angular

Angular2 : Call method/ngoninit when parameter of route changes

橙三吉。 提交于 2021-02-18 12:09:41
问题 Right now I'm making a kind of web shop, and on my home page I've a dropdown of category Let say parent cat A, and sub cats B and C. Cat A, B and C are all represented by 1 component, CatAComponent. When I go in the first time in one of those cats, my ngoninit gets called and the pages displays what it needs to display. When I want to click on another sub cat, I'm still on the same component, but only a param of the route changes ( e.g. I was on localhost:123/CatA/CatB, now I'm on localhost

Angular2 : Call method/ngoninit when parameter of route changes

落爺英雄遲暮 提交于 2021-02-18 12:04:32
问题 Right now I'm making a kind of web shop, and on my home page I've a dropdown of category Let say parent cat A, and sub cats B and C. Cat A, B and C are all represented by 1 component, CatAComponent. When I go in the first time in one of those cats, my ngoninit gets called and the pages displays what it needs to display. When I want to click on another sub cat, I'm still on the same component, but only a param of the route changes ( e.g. I was on localhost:123/CatA/CatB, now I'm on localhost

How To Use LOCALE_ID In Angular i18n Router Module

China☆狼群 提交于 2021-02-18 11:40:47
问题 Im building a small Angular Application with Angular's i18n setup. Everything ist working fine, except for the translations of the url paths and slugs. I tried a possible solution with providing a routing module per language (as described here), but this did not work. I thought that I could do something like the following, but I can't figure out where to inject LOCALE_ID : app-routing.module.ts import { LOCALE_ID, NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular

How to set selected row programmatically in Kendo Grid + Angular 4?

佐手、 提交于 2021-02-18 11:33:55
问题 I have app on Angular 4 + TypeScript + Kendo UI. Also I have a page with table of users. After editing user I want to highlight user by ID that I edited. users: Observable<Array<User>>; selectedId: number; gridView: GridDataResult; ngOnInit() { this.users = this.route.params .switchMap((params: Params) => { this.selectedId = +params['id']; return this.adminService.getUsers(); }); }); } Also I found in Kendo documentation event with " index " and " selected " fields: selectionChange(event:

actual use of foundation and adapter class of mdc-components

*爱你&永不变心* 提交于 2021-02-18 11:19:31
问题 I am trying mdc-components with angular4 project created using angular-cli . So I installed moduled using npm command npm install material-components-web this installed "material-components-web": "^0.22.0" Then created a component that contains HTML markup of slider <div #slider class="mdc-slider" tabindex="0" role="slider" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" aria-label="Select Value"> <div class="mdc-slider__track-container"> <div class="mdc-slider__track"></div> </div>

sockjs-node/info? 404 (Not Found)

纵饮孤独 提交于 2021-02-18 11:14:45
问题 I've done lost of search for couple of hours now and still can't find what I'm looking for. Basically I get this error in the console when running ng serve in my Angular 6 app : GET http://local.mywebsitesecure.com/sockjs-node/info?t=1540568455931 404 (Not Found) Based on my research the solution could be just updating webpack.config.js However, I can't find webpack.config.js in my project. They also say to do: "ng eject" to create a webpack, but it doesn't seem to work. SOLUTION: I can get

sockjs-node/info? 404 (Not Found)

心不动则不痛 提交于 2021-02-18 11:14:09
问题 I've done lost of search for couple of hours now and still can't find what I'm looking for. Basically I get this error in the console when running ng serve in my Angular 6 app : GET http://local.mywebsitesecure.com/sockjs-node/info?t=1540568455931 404 (Not Found) Based on my research the solution could be just updating webpack.config.js However, I can't find webpack.config.js in my project. They also say to do: "ng eject" to create a webpack, but it doesn't seem to work. SOLUTION: I can get

Conditionally load module on the empty path in Angular router

穿精又带淫゛_ 提交于 2021-02-18 11:00:22
问题 I'm trying to load the home page of my app for visitors who are not authenticated. const routes: Routes = [ { path: '', loadChildren: './home/home.module#HomeModule' } ... Authenticated users should get their feed via that module, also on the empty path. { path: '', loadChildren: './feed/feed.module#FeedModule', canActivate: [IsAuthenticationGuard] }, { path: '', loadChildren: './home/home.module#HomeModule', canActivate: [NoAuthenticationGuard] }, I would expect that IsAuthenticationGuard

Get multiple ng-template ref values using contentChildren in angular 5

回眸只為那壹抹淺笑 提交于 2021-02-18 10:36:09
问题 I am trying to pass multiple ng-template to my reusable component (my-table component), content projection. Now I need to get the reference value of each passed ng-template so I can use that value to know, which template is passed for which column. Basically I am creating a reusable table component (on top of Angular material table) where user can pass an separate template for each column. Kindly suggest - OR is there a better approach of doing this? temp.component.ts import { Component,

Pipe and Tap VS subscribe with ngxs

自闭症网瘾萝莉.ら 提交于 2021-02-18 10:16:06
问题 I am playing around with pipe and subscribe. If I am using pipe with tap, nothing will log in console. If I am using subscribe, it's working. So what I am doing wrong? import { Observable } from 'rxjs'; import { tap, take } from 'rxjs/operators'; this.store.select(state => state.auth.authUser).pipe( take(1), tap((data) => { //Not Working - no console output console.log('[Tap] User Data', data); }) ); this.store.select(state => state.auth.authUser).subscribe((data) => { // Working - user data