angular-components

How to inject SVG icon sprites in Angular component HTML DOM?

心不动则不痛 提交于 2020-01-01 06:56:08
问题 I am building an Angular application (Angular 4/5/6) and would like to use SVG sprites in my component template. Question: Assuming I already have my SVG icon sprite generated ( icons.svg ), how can I get Angular to inject/import my SVG icon sprite into my component's template? Is there a way to inject/import my SVG icon sprite into my component without having to use any 3rd party modules/directives and do it natively with Angular itself? Background/Issue: As discussed in this article, icons

fetch all values in form using ngModel directive in angular

我们两清 提交于 2019-12-31 07:14:22
问题 I am trying to fetch all the values which are in form using ngModel but some how I am getting only first text boxes values. Not getting textbox values added on click of button. Example: stackblitz html: <form #profileSetUpForm="ngForm" (ngSubmit)="saveData(profileSetUpForm)" class="form "> <div class="row m-0"> <div class="col-lg-12 col-md-12 col-sm-12 col-12 profile-input-label"> Tab Name </div> <div class="col-lg-4 col-md-12 col-sm-12 col-12 mt-top-5"> <input type="text" [(ngModel)]=

No provider for ControlContainer - Angular 5

自古美人都是妖i 提交于 2019-12-30 07:55:13
问题 I am converting a purchased, third-party template into an Angular 5 app, and just ran into an error. I am very new to Angular 5 (I know AngularJS well however) and don't understand what it's trying to tell me? It seems to be related to a button which shows/hides the top navbar. Error Message (from browser): Error: Template parse errors: No provider for ControlContainer ("imalize-styl-2 btn btn-primary " (click)="toggleNavigation()"><i class="fa fa-bars"></i> </a> [ERROR ->]<form role="search"

Angular pass multiple templates to Component

两盒软妹~` 提交于 2019-12-30 00:38:55
问题 I'm trying to create a component that accepts multiple templates as inputs. This is the example I have: @Component({ selector: 'data-list', styles: [ require('./data-list.component.scss') ], template: ` <ng-template *ngFor="let item of itemsData" ngFor let-item [ngForOf]="[item]" [ngForTemplate]="itemTemplate" ></ng-template> ` }) export class DataListComponent { @Input() itemsData: any[]; @ContentChild(TemplateRef) itemTemplate: TemplateRef<ElementRef>; } As you can see it's a fairly simple

Communicating Events from Parent to Child in AngularJS Components

柔情痞子 提交于 2019-12-29 10:37:27
问题 in the new project I'm working on I've started using the components instead of directives. however, I've encountered an issue where I cannot find a concrete standard way to do it. It's easy to notify an event from child to parent, you can find it on my plunkr below, but what's the correct way to notify a event from parent to child? Angular2 seems to solve this issue by using something like this: https://angular.io/docs/ts/latest/cookbook/component-communication.html#!#parent-to-child-local

@angular/cli: 1.4.1 Angular Generate Component but it returns home.component.css

房东的猫 提交于 2019-12-25 18:33:20
问题 $npm install -g @angular/cli $ng new angular --routing --style=sass $ng g c home "apps": [ { "styles": [ "styles.sass" ], } "defaults": { "styleExt": "sass", "component": { } } I want to sass style in angular, I use angular cli, I try to generate component it returns with style with prefix css. May you help me to fixing that? Thanks in advance for your answer. 回答1: I just migrated from @angular/cli@1.0.3 to @angular/cli@1.4.2 and I am facing the same issue. Turns out it's due to a bug

How to access the values through directive tag in angular 2

你离开我真会死。 提交于 2019-12-25 16:57:25
问题 My firsthtml, <modal [hero]="imageId"></modal>--> My first.component.ts, export class CommonComponent { photodata:any; imageId:any = '2'; } My model.component.ts, @Component({ selector: 'modal', templateUrl: './app/modal/modal.component.html', providers: [HeaderClass] }) export class ModalComponent implements OnInit { @Input() hero: string; console.log(hero)--->Undefined constructor(){ console.log(this.hero)---->undefined } ngOnInit(){ console.log(this.hero)---->2 } } Here when I console it

Can't bind to 'thick' since it isn't a known property of 'ng-progress'

自闭症网瘾萝莉.ら 提交于 2019-12-25 09:29:02
问题 I am trying to use this plugin to my app: https://github.com/MurhafSousli/ngx-progressbar#user-content-automagic-loading-bar Its working fine, but when I run test on it, it fails with error: Can't bind to 'thick' since it isn't a known property of 'ng-progress'. app.module.ts import { NgProgressCustomBrowserXhr, NgProgressModule } from 'ngx-progressbar'; @NgModule({ declarations: [ AppComponent ], imports: [ NgProgressModule ], providers: [ { provide: BrowserXhr, useClass:

How to use autoprefixer with Webpack 1.x.x?

£可爱£侵袭症+ 提交于 2019-12-25 08:28:35
问题 I'm writing an Angular 1.5.x app with components that embed their own style. The <leave-calendar> component define a linear-gradient background which works fine on Firefox but need the vendor prefix in Chromium. Here is what I have done so far: Requirements a working component ; installed postcss-loader : yarn add --dev postcss-loader add browserslist to package.json : "browserslist": [ "> 1%", "last 2 versions", "ie 9" ] leave-calendar.html <style lang="scss"> .leave-draft { background-color

$location.search() equivalent in Angular 7

删除回忆录丶 提交于 2019-12-24 12:20:10
问题 I am migrating Angular JS to Angular 7. I am looking at this code and trying to implement in Angular 7. In the service, $location was injected, and the following methods reset and set the query parameters. function resetAllOptions() { // Clears query params $location.search(''); } function setQueryParameters() { // Sets query parameters $location.search({ searchType: searchType, searchField: searchField, searchValue: searchValue, searchValueTwo: searchValueTwo, searchValueThree: