phpcn_u15822017-05-15 17:00:40
The
ng-style directive corresponds to a key-value pair composed of CSS attributes. It is an object and adds the corresponding style to the corresponding element. The following is an example given in the Angular API document. The document address is https://docs. angularjs.org/api/ng/directive/ngStyle You may need to circumvent the firewall, or you can read the explanation of the novice tutorial http://www.runoob.com/angularjs/ng-ng-style.html
<input type="button" value="set color" ng-click="myStyle={color:'red'}">
<input type="button" value="set background" ng-click="myStyle={'background-color':'blue'}">
<input type="button" value="clear" ng-click="myStyle={}">
<br/>
<span ng-style="myStyle">Sample Text</span>
<pre>myStyle={{myStyle}}</pre>