Select one ... (check one with "x")
[ ] bug
[ x] feature request
[ ] enhancement
It would be nice to be able to pass in the shape of a clarity icon.
This way we won't have to define multiple icons and exclude them with *ngIf or other similar mechanism, instead we could define an icon with interpolated shape and based on logic in the controller class set its value.
Trying to write something like this in the html template:
<clr-icon shape="{{iconShape}}"></clr-icon>
or
<clr-icon [shape]="iconShape"></clr-icon>
Causes browser to fail with
Can't bind to 'shape' since it isn't a known property of 'clr-icon'.
Here is example on plnkr(see app.component.ts and app.component.html files for the change): https://plnkr.co/edit/H5dy79?p=preview
Angular version: 2.2.3
Clarity version: 0.7.3
OS and version:
Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
@dennitsa: you have to use attribute binding to do that. Please check this plnkr: https://plnkr.co/edit/3Z9gCqlBHuQreWM4tYRz?p=preview
<clr-icon [attr.shape]="iconShape"></clr-icon>
More info here: https://angular.io/docs/ts/latest/guide/template-syntax.html
Great, thanks!
Just FYI for angular 1 users: we can use <clr-icon ng-attr-shape="{{iconShape}}"></clr-icon>
Hi there 馃憢, this is an automated message. To help Clarity keep track of discussions, we automatically lock closed issues after 14 days. Please look for another open issue or open a new issue with updated details and reference this one as necessary.
Most helpful comment
@dennitsa: you have to use attribute binding to do that. Please check this plnkr: https://plnkr.co/edit/3Z9gCqlBHuQreWM4tYRz?p=preview
<clr-icon [attr.shape]="iconShape"></clr-icon>More info here: https://angular.io/docs/ts/latest/guide/template-syntax.html