angular2-template Questions

1

I have the next component which is a time input @Component({ selector: 'time-cell', template: `<input #input [ngModel]="value" (ngModelChange)="onModelChange($event)" placeholder="00:00">`...
Dermatogen asked 4/11, 2016 at 13:7

3

Solved

I can render the following Angular 2 component containing an <input> with a maxlength set: @Component({ selector: 'app', template: '<input maxlength="10">', }) export class ...
Kennard asked 29/9, 2016 at 3:31

4

Solved

Is it possible to use <ng-content> (and its select option) inside a <ng-template> or does it only works within a component ? <ng-container *ngTemplateOutlet="tpl"> <span gree...
Kablesh asked 21/8, 2018 at 12:6

4

Solved

I need to pass an array of values to a component using binding, e.g. @Component({ selector: 'my-component', template: '<div data="[1, 2, 'test']"></div> }) export class MyComponent {...
Cd asked 4/7, 2016 at 6:40

14

Is there a way that I could limit the length of the string to a number characters? for e.g: I have to limit a title length to 20 {{ data.title }}. Is there any pipe or filter to limit the length? ...
Efren asked 21/6, 2017 at 7:22

4

Solved

So I want to make an anchor element on my Header disappear when a specific page is hit. How can I catch the url in the *ngIf when that page is hit. I have a header which will remain same for all pa...
Subpoena asked 8/6, 2017 at 7:28

12

Solved

I'm working on an Angular2 application, and I need to display -- but disable an <a> HTML element. What is the correct way to do this? Updated Please note the *ngFor, this would prevent the ...
Bautzen asked 2/5, 2016 at 14:38

4

Solved

I have a question regarding dynamic component creation in Angular 2 rc5. So let's assume that we have two plain angular components: @Component({ template: ` <div id="container"> <h1&...
Quartus asked 6/9, 2016 at 20:20

14

Solved

Using Angular 2, I want to duplicate a line in a template multiple times. Iterating over an object is easy, *ngFor="let object of objects". However, I want to run a simple for loop, not a...
Theosophy asked 18/3, 2016 at 22:47

3

In my Angular 2 application I have a list of users "Users:any" which contain the properties: name, job, age... etc. The problem is that to get the profile image I have to get the the id o...
Histology asked 9/11, 2016 at 16:1

10

i Used the ngx-bootstrap Modal. But i faced problem when i used the mat-select inside of it . The mat-select Options display behind the Modal . i already these solutions here solution and also this...

15

Solved

I am stuck in a situation here. I am getting an error like this. compiler.es5.js:1694 Uncaught Error: Unexpected value 'LoginComponent' declared by the module 'AppModule'. Please add a @Pipe/@Di...
Sanctum asked 3/10, 2017 at 17:6

29

Solved

In my Angular 2 app when I scroll down a page and click the link at the bottom of the page, it does change the route and takes me to the next page but it doesn't scroll to the top of the page. As a...

15

Solved

I'm trying to implement Dynamic Forms in Angular 2. I've added additional functionalities like Delete and Cancel to the dynamic forms. I've followed this documentation: https://angular.io/docs/ts/l...
Gallicize asked 10/8, 2016 at 17:41

25

Solved

I am writing an Angular application and I have an HTML response I want to display. How do I do that? If I simply use the binding syntax {{myVal}} it encodes all HTML characters (of course). I ne...
Enkindle asked 21/7, 2015 at 19:48

3

Solved

It is giving responce.json () is not a function for my case. File component.ts this.AuthService.loginAuth(this.data).subscribe(function(response) { console.log("Success Response" + respo...
Donate asked 13/2, 2017 at 11:29

9

Solved

Here's the code I'm trying to get to work (angular 5): import { Component, ViewChild, TemplateRef, ViewContainerRef } from '@angular/core'; @Component({ selector: 'vcr', template: ` <templ...
Tempestuous asked 7/11, 2017 at 11:49

41

Solved

I'm using Angular2 2.1.0. When I want to display a list of companies, I got this error. in file.component.ts : public companies: any[] = [ { "id": 0, "name": "Available&qu...
Staal asked 30/10, 2016 at 17:12

12

Solved

I have read NgStyle Documentation For Angular 2, and it is a little bit confusing for me. How do I use NgStyle with condition like (if...else) to set background image of any element?
Lew asked 5/5, 2016 at 13:9

11

Solved

I dont't know how to add to my component <component></component> a dynamic class attribute but inside the template html (component.html). The only solution I found is to modify the it...
Wattmeter asked 6/1, 2016 at 19:33

7

Solved

I have a simple app created with Angular-CLI, I wanted to refactor and move the app.component.ts code in separate component file and started to get a nasty error: Module not found: Error: Can't...
Forsooth asked 4/3, 2017 at 5:21

1

I have a solution to the problem of importing static content and using it in a template, but I am not sure it is the right one, so I would like to hear if there is an official/better way of doing i...
Imaginable asked 28/12, 2016 at 8:52

2

Solved

@Component({ selector: 'bancaComponent', templateUrl: '{{str}}' }) export class BancaComponent implements OnInit { str: String; constructor(private http: Http) { } ngOnInit(): void { this.st...
Proteiform asked 6/11, 2017 at 8:54

7

Solved

I am writing an Angular 2 unit test. I have a @ViewChild subcomponent that I need to recognize after the component initializes. In this case it's a Timepicker component from the ng2-bootstrap libra...
Circumlunar asked 10/3, 2017 at 17:19

4

Solved

I want this: <div *ngIf="...">div 1...</div> <div *ngIf="...">div 2...</div> <div *ngIf="...">div 3...</div> But I don't wanna repeat the *ngIf, so I created ...

© 2022 - 2025 — McMap. All rights reserved.