Hello

In angular2, wanted to apply a directive to an input element with a 
specific class "myCurrencyFormatter"

      @Directive({ selector: '.myCurrencyFormatter' })


      and <input class=".myCurrencyFormatter" />

this seems to work

however need to do dinamically based on a parameter:

       <input [ngClass]="myCurrencyFormatter" />

this is not working (not applying the directives)


only Workaround is now in the directive code check if the element has the 
class:

  @HostListener("blur", ["$event.target.value"])
  onBlur(value) {
           if 
(this.el.getAttribute("class").indexOf("myCurrencyFormatter")!=-1) {
                this.el.value = this.currencyPipe.transform(value);
        }
  }



Are attribute directives applied only once and cannot reevaluate? Is there 
another solution?


thanks

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to