Questions tagged [angular2-directives]

Use for questions about Angular 2+ directives

1806 questions
0
votes
3 answers

Angular2,Typescript:How to insert a key:value pair at a PARTICULAR index in an array?

I want to insert a key value pair at a particular index in an array.How do I do that ? this is my code so far: this.quiz.push( { "question-no":this.no, "Ans":this.ans } I need it in that way because this is to store the choice selected by the…
0
votes
1 answer

Displaying static content with angular2

Please forgive the newbie question; I'm just starting out with angular2. I've made it through the angular heroes demo and understand how components work, how to connect data to html, etc. But what if I have a piece of static html that I want to…
EmmyS
  • 11,892
  • 48
  • 101
  • 156
0
votes
1 answer

How to change navigation bar name and icons dynamically on each page based on url ? Angular 2

I need to change the navigation bar names and icons dynamically based on the page URL. Here is my code:
0
votes
1 answer

(click) event throwing Error in angular2, typescript

(click) event in typescript causes error given below. EXCEPTION: Error during evaluation of "click" ORIGINAL EXCEPTION: TypeError: Cannot read property 'appendChild' of undefined angular2.dev.js:23877 ORIGINAL STACKTRACE: angular2.dev.js:23877…
Zeeshan Malik
  • 627
  • 1
  • 14
  • 31
0
votes
1 answer

Angular2,Ionic2: How to do 2way binding for radio button in nested *ngfor using ngModel?

I've my API in JSON in the following format. I want to display this in the form of question & choices format. I'm trying to display the choices using radio buttons. But my ngModel is not working. I want to access the whole object of the selected…
0
votes
4 answers

ngIf in angular 2 not working

Here user is the variable that I have assigned in the component. That is a string…
Sreekar Sree
  • 404
  • 5
  • 14
0
votes
0 answers

Clicking outside an element directive won't work for more than one instance. How to improve it?

I'm using this nice directive to catch ouאside click of a table: @Directive({ selector: '[clickOutside]' }) export class ClickOutsideDirective { constructor(private _elementRef: ElementRef) {} @Output() public clickOutside = new…
AngularOne
  • 2,760
  • 6
  • 32
  • 46
0
votes
2 answers

How to generate textarea dynamically when checkbox is checked in angular2

I am new to Angular2, trying to generate textarea dynamically when checkbox is checked and delete textarea when checkbox is unchecked in angular2., Is there any better solution? thanks in advance.
0
votes
0 answers

@input only updating one component variable in angular2

I have two components. Project calendar view component - parent Project list view component - child for project calendar In Project calendar I have variable like @Input() projects : Project[] = []; In Project list view component I have…
Govinda raj
  • 613
  • 3
  • 16
  • 31
0
votes
2 answers

How do I subscribe to the setItems$ Observable in angular-2-local-storage

I'm using angular-2-local-storage which has an observable of setItems$ that I'm trying to... Observe, with the following code in a directive: /** app-theme.directive.ts **/ import { Directive, ElementRef, Input } from '@angular/core'; import {…
0
votes
1 answer

_this.files.filter is not a function ng2-uploader angular2 file upload

I am newbie to Angular2 and Implementing file upload in Angular2 using ng2-uploader module. the uploading is working fine but i am getting below errors on console. can any one help me sort out this After file uploading I am getting the console error…
0
votes
0 answers

Directives Angular 4 with JQuery Library does not work

I use a JQuery Library (iCheck) and I want to do a directive for use it in my html component but it does not work .. My code : Directive.ts import { Directive, ElementRef, HostListener, Input, AfterViewInit } from '@angular/core'; declare var…
user1814879
  • 984
  • 6
  • 23
  • 49
0
votes
0 answers

angular 2 NgIf hides ever, even observable will get from null to object

I would like to show the something only if the user is logged in. The user is an observable and to show/hide I would like to use NgIf. But the NgIf hides the content forever, even I see could verify the user changed from null to an…
mnewmedia
  • 485
  • 1
  • 6
  • 20
0
votes
2 answers

How can i emit a string in service and get in component

I want to emit a string when the util.service.ts handled some errors, so that i can get this message in app.component.ts and show it, but i can not subscribe the emitter. this is my code, but it do not work: in util.service.ts: export class…
0
votes
1 answer

Angular 2 select option State

I am using select2(https://github.com/NejcZdovc/ng2-select2.) in my Angular 2 application. The form is based on reactive/Model based form. I want to know how to activate its different states(dirty,touched,pristine) for the select option. The…
ZAJ
  • 793
  • 3
  • 23
  • 50