angular2-directives Questions

17

Solved

What am I doing wrong? import {bootstrap, Component} from 'angular2/angular2' @Component({ selector: 'conf-talks', template: `<div *ngFor="talk of talks"> {{talk.title}} by {{talk.speake...
Tidewater asked 1/12, 2015 at 3:52

6

Solved

I'm confused a little. See this simple directive: @Directive({ selector: '[myDirective]' }) export class MyDirective { private text: string; private enabled: boolean; @Input() myDirectiv...
Pitching asked 26/4, 2017 at 11:53

4

The way I understand Angular 2, the ViewChildren decorator allows a Component to get a Query for other Components or Directives. I can get this to work in Typescript when I know the specific Type o...
Quirk asked 29/3, 2016 at 14:14

10

Solved

In this scenario, I'm displaying a list of students (array) to the view with ngFor: <li *ngFor="#student of students">{{student.name}}</li> It's wonderful that it updates whenever I ...
Blastocyst asked 24/12, 2015 at 18:7

5

Solved

Given a simple input element I can do this: <input [(ngModel)]="name" /> {{ name }} This doesn't work for my custom elements: <my-selfmade-combobox [(ngModel)]="name" ...
Wherein asked 2/2, 2016 at 9:30

2

I need to do a progress arc based on the calculated percentage, I have created a custom directive to access the svg attributes from the user, while updating that in my template, I am getting the fo...
Clientele asked 11/7, 2016 at 11:57

6

Solved

In my app I want to automatically set focus on first field of form on component load. Can anyone please guide how to achieve this without any repetition as I want this on every form (Reactive Forms...
Pythagoreanism asked 19/9, 2016 at 22:18

3

Solved

I have created an attribute directive myOptional meant to be used on inputs in a form, and its purpose is to indicate that certain fields are optional. This is done by adding a class to the input a...
Hothouse asked 20/9, 2016 at 23:22

4

I am using Angular 2 and would like to check if a variable value is undefined using the htm *ngIf condition. If I use <span *ngIf="!testvar">, it also covers the case when variable testvar =...
Universalize asked 22/8, 2017 at 22:2

1

Solved

I had some confusion regarding ngTemplateOutletContext , specifically how it is passed to ngTemplate or who passes it to ngTemplate which surrounds the element on which *ngFor was applied. The conf...

5

Solved

I have this element that I'm referencing by Id: let infiniteScrollElement = document.getElementById('th-infinite-scroll-tracker'); I need to listen when the browser is has reached the bottom of...
Disinter asked 17/11, 2016 at 20:50

4

While creating model driven form, i am getting an error: Error: formControlName must be used with a parent formGroup directive. You'll want to add a formGroup directive and pass it an existing For...

4

I have a number that can be positive or negative value. I want to always print it as negative. Is there a way to format it in Angular 2 html code? I know how to do it in typescript/javascript. But,...
Punchy asked 22/8, 2017 at 15:39

5

Solved

I have this inputs generated dynamically: <div *ngFor="let cell of column; let i = index;"> <!-- Material design input--> <md-input id="my-input-{{i}}"> </md-input> &l...
Scrubber asked 10/11, 2016 at 18:55

3

I have a directive where I defined a radio button and I want to call a method of a component .. Whene I inject the component in constructor I got this error : ERROR Error: No provider for FoldersCo...
Conceit asked 14/6, 2017 at 10:5

4

Solved

Suppose I have a component I want to test that uses a very complex component. Furthermore it calls some of its methods using references obtained by @viewChildren. For example @Component({ module...
Bistort asked 29/11, 2016 at 0:33

3

Is there a way to dynamically set the value of the *ngTemplateOutlet directive? Something along those lines: <div *ngFor="let item of [ 'div', 'span' ]"> <ng-container *ngTemplateOutlet...
Felice asked 23/4, 2017 at 23:6

4

I understand that provider is for getting service from another class but what is multi-provider and token thing? And also when we do multi=true ? provide(NG_VALIDATORS, { useExisting: class), mul...
Williswillison asked 1/7, 2016 at 11:45

3

Solved

I've got a HighlightDirective which does highlight if the mouse enters an area, like: @Directive({ selector: '[myHighlight]', host: { '(mouseenter)': 'onMouseEnter()', '(mouseleave)': 'onMouse...
Improvvisatore asked 28/6, 2016 at 7:3

3

Solved

I have created a simple directive to trim my input text (I plan to expand it's functionality later - so please don't recommend a simple onkeyup function), I would like to make a directive work. I ...
Frydman asked 18/9, 2017 at 23:12

3

I have a directive that appends decimals, if the input value is a whole number, on blur. Below is the implementation. import { Directive, ElementRef, Input, OnInit, HostListener, forwardRef } from...
Mariehamn asked 27/1, 2018 at 5:23

3

Solved

i'm writing custom angular(Angular 2.0.0) validation, following this guide https://angular.io/docs/ts/latest/cookbook/form-validation.html#!#custom-validation . @Directive({ selector: '[ngModel][...

4

Solved

What is the best practice to check if user has scrolled to the bottom of the page in Angular2 without jQuery? Do I have access to the window in my app component? If not should i check for scrolling...
Unwilled asked 7/7, 2016 at 16:55

6

Solved

I realize, this question is repeated but previous once does not provide apt answer moment package was already installed 1.Installed package npm install moment-timezone --save Inside node_modul...
Moorfowl asked 30/7, 2016 at 14:9

4

Solved

Using a custom directive how would you add/remove a class on the host element based on a specific conditions? Example: @Directive({ selector: '[customDirective]' }) export class CustomDirective ...
Leban asked 7/1, 2017 at 10:58

© 2022 - 2024 — McMap. All rights reserved.