angular6

No config found or get/set have been deprecated in angular 6

不想你离开。 提交于 2019-12-19 23:21:39
问题 ng config --global defaults.styleExt=scss Error: config not found ng set --global defaults.styleExt=scss Error: get/set have been deprecated in favor of the config command. Installed Packages versions ngular CLI: 6.0.3 Node: 8.11.1 Angular: 6.0.2 @angular/cli 6.0.3 @ngtools/webpack 6.0.3 webpack 4.8.3 update The following command gave me an error in the image ng config schematics.@schematics/angular:component '{ styleext: "scss"}' 回答1: ng set --global defaults.styleExt=scss is deprecated

Angular Material component not working: 'mat-option' is not a known element

时光总嘲笑我的痴心妄想 提交于 2019-12-19 17:45:00
问题 I am trying to add angular material component. but the component did not work properly. that error said Uncaught Error: Template parse errors: 'mat-option' is not a known element: // ... I think the error comes from app.module.ts : import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; import { SidebarComponent } from './sidebar/sidebar

Angular 6: How to build a simple multiple checkbox to be checked/unchecked by the user?

对着背影说爱祢 提交于 2019-12-19 03:16:26
问题 I am writing this post after having read several threads concerning this topic but no one of them gives me what I need. This post seems to have the solution but I do not have to read the checked values from the json. All I need is to: read countries from an array of objects build dinamically a list of checkbox representing each country user should check and uncheck each checkbox bonus: get the value of the checked input and send it outside the component I know It might be really dumb to do

Using scss as default style sheet in Angular 6+ (styleExt)

前提是你 提交于 2019-12-18 14:06:10
问题 Apparently the way to declare the default stylesheet extension changed from Angular 6 onwards. The styleExt property in the angular.json is not recognised any longer. For new projects this can be set with an option on the CLI --style=scss on the new command. However, how do you change this for exsting projects that I migrate from Angular <5 or if you forgot to do this during project creation? This question is meant to be strictly related to the breaking changes by the version 5 to 6 of

WebStorm - Argument type {providedIn: “root”} is not assignable to parameter type {providedIn: Type<any> | “root” | null} & InjectableProvider

有些话、适合烂在心里 提交于 2019-12-18 14:03:57
问题 I'm trying to migrate my app from Angular v5 to v6 and I face the following typescript error while trying to specify providedIn in my providers Argument type {providedIn: "root"} is not assignable to parameter type {providedIn: Type | "root" | null} & InjectableProvider @Injectable({ providedIn: 'root', }) export class MyService { } I copied and pasted the code from the Angular doc https://angular.io/guide/dependency-injection Any idea? UPDATE I have created a blank project ng new ... and

Multiple ng-content

谁说我不能喝 提交于 2019-12-18 10:55:12
问题 I am trying to build a custom component using multiple ng-content in Angular 6, but this is not working and I have no idea why. This is my component code: <div class="header-css-class"> <ng-content select="#header"></ng-content> </div> <div class="body-css-class"> <ng-content select="#body"></ng-content> </div> I am trying to use this component in another place and render two different HTML code inside body and header select of ng-content , something like this: <div #header>This should be

Multiple ng-content

痞子三分冷 提交于 2019-12-18 10:55:03
问题 I am trying to build a custom component using multiple ng-content in Angular 6, but this is not working and I have no idea why. This is my component code: <div class="header-css-class"> <ng-content select="#header"></ng-content> </div> <div class="body-css-class"> <ng-content select="#body"></ng-content> </div> I am trying to use this component in another place and render two different HTML code inside body and header select of ng-content , something like this: <div #header>This should be

Ionic 4: “Loading Controller” dismiss() is called before present() which will keep spinner without dismissing

拈花ヽ惹草 提交于 2019-12-18 10:54:39
问题 I used "Ionic Loading Controller" to show a spinner until the data is retrieved then it calls "dismiss()" to dismissed it. it works fine, but sometimes when the app already have the data, the "dismiss()" is called before the "create()" and "present()" is done which will keep the spinner without dismissing... I tried to call the data inside "loadingController.present().then()", but that caused the data to be slower... is this a bug? how to solve the this issue? Example of my code: customer:

Form custom fields validation angular 2

て烟熏妆下的殇ゞ 提交于 2019-12-18 09:49:47
问题 I try form template driven validation for select and radio buttons and checkboxes but not working these custom fields. How we can validate these fields.I do not know how to do it.Please anyone help me to resolve this issue. <!--Country--> <div class="form-group"> <label for="country">Country</label> <app-selectbox name="country" [(inputModel)]="model.country" [(ngModel)]="model.country" #country="ngModel" required> <option [ngValue]="null">---Select---</option> <option *ngFor="let item of

Angular 6 - Rendering problems if BrowserAnimationsModule imported (Openlayers)

痴心易碎 提交于 2019-12-18 09:37:12
问题 I basically have a App which renders a small map. On this page is also a "toggle" button which hides the small map with a *ngIf in the parent component and displays the map in large instead. If I now import BrowserAnimationsModule in app.module.ts the large map is not rendered if I click on the toggle button (only if i set a timeout of 1ms before the map is created in ngOnInit of map-base.component.ts). Sorry..it's a bit hard to explain, here's the code: App.module.ts ... @NgModule({