I have custom popover directives and other custom directives that use one I can set the width of the pop-up I'm trying to use ng-style for a code snippet from the HTML template of Directive:
& lt; Div my-custom-popover ng-style = "{'width': widthVar}" & gt; ... & lt; / Div & gt;
Here's interesting: ng-style is also applicable in my-custom popover
HTML code from my-custom popover
Here's the code:
& lt; Div ng-style = "{display: (condition? 'Block': 'any')} & gt; ... & lt; / Div & gt; The problem is that when the angular tries to render my instruction instead of adding the smart and current ng style, it only connects them and returns results in the parsing error. As long as the browser sees my markup, it seems that ng-style = {'width': widthVar} {display: (condition? 'Block' 'none')}
Is wrong from Does anyone say that my NG-style should be linked to the existing one and not just like the contention?
In general, using inline CSS rules is not a good idea, because if you have different Elements have the same rules and they need to be changed, so you have to do this in each element which can be a hassle and you can remember one, instead, I will import only one CSS file so that the rule will be changed easily Could.
After saying this, I will use ng-class instead of ng-level place in your instructions and I will implement the CSS rules. For example, you can change
ng-style = "{display: (condition '' block ':' none ')}"
ng-class = "{show-divi": show, 'hidden-day': show} "
and then create a CSS file and apply the following rules Do:
.show-div {display: block;} .hide-div {display: none;}
No comments:
Post a Comment