angular4

Angular2 applying Pipe after data is received

老子叫甜甜 提交于 2020-01-24 05:39:18
问题 I have an Object that is used to manage the data received from the back end. It is initiated with all the fields as display: false , and if I receive that specific field from the server, I will eventually change it to true . filterGroups (initial): export let filterGroups: any = { genericFilters: { iboId: { 'display': false, 'template': '' }, iboCode: { 'display': false, 'template': 'text/iboCode' }, iboName: { 'display': false, 'template': 'text_input_iboName' }, iboSurname: { 'display':

Angular4 - Change state from component not template

会有一股神秘感。 提交于 2020-01-11 09:33:07
问题 In AngularJS I used ui-router for redirecting inside of my app(changing state). It has 2 possible options to redirect In template ui-sref='stateName' In controller $state.go() I just start play with Angular (4) and I found only way how to change route from template with something like: Template routerLink="routePath" Is there some way as there was in ui-router to change route from component? 回答1: constructor(private router:Router) {} changeRoute() { this.router.navigate(...) // this.router

Angular2: Use Pipe to render templates dynamically

旧巷老猫 提交于 2019-12-28 03:11:48
问题 I am creating a form where I get the fields from the backend. After mapping, I have something like this: genericFilters: { iboId: { 'display': false, 'template': '' }, iboCode: { 'display': true, 'template': 'text_input_iboCode', /*'template': 'text/iboCode'*/ }, iboName: { 'display': true, 'template': 'text_input_iboName' }, iboSurname: { 'display': true, 'template': 'text_input_iboSurname' }, iboRank: { 'display': false, 'template': 'multiselect_iboRank', /*'template': 'select/multi_iboRank

Cannot Upgrade a Existing Angular Cli project to Angular 4 Rc1

廉价感情. 提交于 2019-12-24 10:47:22
问题 I am trying to use the following command to upgrade to Angular 4 Rc1 npm install @angular/{common,compiler,compiler-cli,core,forms,http,platform-browser,platform-browser-dynamic,platform-server,router,animations}@next --save This is the command that is suppose to work to convert to angular 4 https://github.com/angular/angular/blob/master/CHANGELOG.md But this Command is giving me a error E:\Softwares\Angular2\Angular2Concepts>npm install @angular/{common,compiler,compiler-cli,core,forms,http

How to deal with losing deep imports in Angular 4

只愿长相守 提交于 2019-12-23 15:36:58
问题 I have just updated to Angular 4 and learned that it no longer supports deep imports . So I was using VALID to help validate forms. But now that the I can't import it with the deep import import { VALID } from '@angular/forms/src/model And since this does not work, import { VALID } from '@angular/forms/' What are we expected to do to access it? Or anything for that matter that was previously accessed with a deep import ? 回答1: Angular 4 no longer supports deep imports . In Angular 2 you could

Angular-cli ignores tsconfig.json

给你一囗甜甜゛ 提交于 2019-12-23 08:28:18
问题 Using "@angular/cli": "^1.0.0" @angular/cli ignores tsconfig.json The project compiles just fine editing / removing tsconfig.json Why is that? 回答1: The reason that your project compiles without $ROOT/tsconfig.json is that @angular/cli supports multiple apps within the root directory; your (single) app is compiling with $ROOT/src/tsconfig.app.json and your test suite with $ROOT/src/tsconfig.spec.json . The root tsconfig.json applies to all apps within the directory. Deleting it simply removed

How do you get Angular 2 (or 4) PrimeNg Charts to refresh asynchronously?

三世轮回 提交于 2019-12-23 04:35:33
问题 Problem: How to get PrimeNg Charts to refresh asynchronously? Scenario: I have a dropdown that I want to refresh the chart based on a user selection. I thought I knew the answer to this question after gaining an understanding of Angular change detection and how I would need to reassign an object for it to see the data had been changed (as opposed to updating the data within the object in place), but after reading about many other charts and even trying them, I learned that the problem was a

In Angular4 - How do I add lodash and do a build without errors

有些话、适合烂在心里 提交于 2019-12-22 10:59:07
问题 I'm using angular.io quickstart seed: https://angular.io/docs/ts/latest/guide/setup.html I'm using Angular4 with typescript JIT Currently I would like to add lodash so I can use this in my component and then do an npm run build e.g. tsc -p src/" and not get any errors My component: import { Component } from '@angular/core'; import * as _ from 'lodash'; @Component({ moduleId: module.id, selector: 'HomeComponent', templateUrl: 'home.component.html' }) export class HomeComponent { constructor()

angular 4 and ng-template

会有一股神秘感。 提交于 2019-12-21 09:15:02
问题 I'm getting this warning: The <template> element is deprecated. Use <ng-template> instead (" [attr.tabIndex]="-1" [ngClass]="{'k-item': true}"> [WARNING ->]<template *ngIf="template" [templateContext]="{ when using angular 4, is this being taken care of for the release version? thanks 回答1: You need to take care of that. You need to modify your code and change all occurences of <template> to <ng-template> <template> caused conflicts with other usages of the <template> tag, therefore the

Add custom elements and attributes to compiler schema

China☆狼群 提交于 2019-12-20 02:30:19
问题 There are some custom elements and attributes in component template (in this example they are used by third-party non-Angular code): <foo></foo> <div data-bar="{{ bar }}"></div> They cause a compiler error: Template parse errors: 'foo' is not a known element: 1. If 'foo' is an Angular component, then verify that it is part of this module. 2. If 'foo' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message. (" [ERROR ->]<foo><