angular2-template

Template property is undefined while others are?

笑着哭i 提交于 2019-12-13 10:18:17
问题 I'm trying to define a simple component, with several properties : randomFile.html : <dico [dicoID]="201125" [dicoLang]="en" [delayedLoading]="false"></dico> <dico [dicoID]="201126" [dicoLang]="en" [delayedLoading]="false"></dico> Here is my component definition : dico.component.ts : @Component({ selector: 'dico', template: `{{text}}` }) class Dico implements AfterViewInit { @Input() private dicoID: string; @Input() private dicoLang: string; @Input() private delayedLoading :boolean; public

Switching the CSS frameworks in Components

淺唱寂寞╮ 提交于 2019-12-13 03:50:21
问题 I am developing a UI application using Angular and I can choose one or more of the following CSS frameworks: Bootstrap 4 Foundation Angular Material ng-bootstrap or ngx-bootstrap. A pre built template that I can purchase. Many others or new ones... Is there a best practice to design the Angular application, so that it will be easy to switch to a different CSS framework further down the line ? One option, I think, is to define a new Feature module, which will import all the controls of a

Angular: Bind date picked from bootstrap-datepicker to underlying ngModel or formControlName

大兔子大兔子 提交于 2019-12-13 03:33:40
问题 I'm using bootstrap-datepicker in my Angular project by creating it as a directive. Below is my code. HTML: <input [datepicker]="datepickerConfig" readonly ngModel name="requestedDate" class="form-control" id="requestedDate" type="text"> Datepicker config in component: datepickerConfig = { format: 'dd-M-yyyy' }; Directive: @Directive({ selector: '[datepicker]' }) export class DatepickerDirective implements OnInit { @Input() datepicker; constructor(private el: ElementRef) { } ngOnInit() { $

How to pass value from ts file to scss file in same component in angular 2+?

只谈情不闲聊 提交于 2019-12-12 22:18:40
问题 This is my component export class myComponent implements onInit { private outageCount; ngOnInit(){ ....subscribe((data) => { this.outageCount = Object.keys(data).length; }) } I need to pass the outageCount to my css before CONTENT :host ::ng-deep app-settings-panel { &:before{ //content:"4"; content:attr(outageCount); background: #941313; position: absolute; top: 3px; left: 22px; border-radius: 50%; height: 13px; width: 13px; border: 1px solid #ffffff; color: white; font-size: 8px; text-align

AspNetCore + Angular 2: WebpackDevMiddleware Error with new project

本小妞迷上赌 提交于 2019-12-12 19:11:56
问题 I'm creating a new project with this tutorial: https://blogs.msdn.microsoft.com/webdev/2017/02/14/building-single-page-applications-on-asp-net-core-with-javascriptservices/ Next some resolved issues, I have now a complete project with all dependencies installed but when I launch the project with IIS, I have this error . L'exception System.AggregateException s'est produite HResult=0x80131500 Message=One or more errors occurred. Source=<Impossible d'évaluer la source de l'exception>

Angular7: Template parse errors: The pipe 'titlecase' / 'slice' could not be found

喜夏-厌秋 提交于 2019-12-12 19:06:55
问题 I'm migrating my app from Angular 6 to Angular 7 After running ng update , and updating my packages , things goes well until i run: ng build --configuration=production it seems that it can't find some angular well known pipes : titlecase / slice : ERROR in : Template parse errors: The pipe 'titlecase' could not be found ("span class="nav-item border-left text-truncate px-2 text-left"> <span class="text-capitalize">{{[ERROR ->]username | titlecase }}</span> <span class="text-capitalize"> <

Angular 2 Custom Structural Directive binding using template input variable is not working

雨燕双飞 提交于 2019-12-12 17:05:47
问题 I have created a custom structural directive similar to ngFor . When I try to use it using <template> element syntax, the binding inside the template is working but when I use * syntax, the binding is not working. <!-- working --> <template edit [editOf]="values" let-val="val"> <table > <span>This is using template syntax {{val}}</span> </table> </template> <!-- not working --> <table *edit="let val1 of values"> <span>This uses star syntax {{val1}}</span> </table> Here is the plnkr link for

Angular2 ngIf not working in deployment environment

旧巷老猫 提交于 2019-12-12 16:46:38
问题 I've written a very simple little Angular2 app that I've built to generate exercise sheets. However it seems that when I deploy the app ngIf doesn't work (either my ISP default webserver or my own Heroku/local deployed node-http-server). When I run the exact same code base on my dev node server ( npm start ) ngIf works as expected. If anyone has some guidance on how I can debug this I would be extremely grateful, or if I'm just plain doing something wrong... Here's the relevant code src

How to bind to a data attribute using Angular 2+?

天涯浪子 提交于 2019-12-12 13:38:03
问题 I am using a data table created mostly with css that I found online. In one of the columns there is a css data attribute "data-title" which is assigned a string. <td data-title="someString"> When I enter a string, the styling inside the column works as expected. When I try to bind to an objects string, the binding doesn't work like I would expect. I tried <td data-title="object.someString"> which just displays literal 'object.someString' and I tried <td data-title="{{object.someString}}">

Angular2 show element on change of selection

做~自己de王妃 提交于 2019-12-12 12:47:18
问题 Using Angular 2 typescript. I only want to show my save button if a new option was selected. Then I want to hide the Save button after it was clicked. How can I do that? Not really sure how to approach this. Code below: HTML <select> <option *ngFor="let option of optionArray" [value]="option">{{option}}</option> </select> <span class="input-group-btn"> <button class="btn btn-primary save-button" type="submit">Save</button> </span> 回答1: You can put ngModel on select field & based on select