Menu
  • HOME
  • TAGS

Default value for AngularJS ng-style

angularjs,ng-style

Just remove the additional parenthesis and it will work: ng-style="{'backgroundColor':button.color || '#FF6600'}" ...

Convert style attribute to ng-style

angularjs,ng-style

That's because it takes an object, no need to do {{}} in there: ng-style="{ borderBottom: 'solid ' + (command.name == 'Delete' ? '1px':'0px') + ' lightgray', paddingBottom: (command.name == 'Delete' ? '10px':'0px') }" ...

Problems using angular ng-style, not updating in IE

javascript,angularjs,ng-style

ng-style accepts an Angular expression that evaluates to an object. This means that if you want to use a variable inside that expression, you can use it directly (without the double-curlies): ng-style="{width: liWidth + 'px'}" Double-curlies are used when you want to insert a dynamic, interpolated value to an argument...

Dynamic refresh background-image with ngStyle In AngularJs

html,css,angularjs,ng-style,angularjs-ng-style

ng-style should not contain {{}} interpolation directive, you could directly access scope variable there. Also backgroundImage should be 'background-image' Markup <div ng-style="{'background-image': 'url('+ example_expression+')'}"></div> Demo Plunkr...

Angular scope's variable from directive not syncing in ng-style

javascript,angularjs,angularjs-directive,ng-style

You have just got your ng-style syntax confused. The value for each of the properties of the object in ng-style is an AngularJS expression, which means you can refer directly to scope properties. Change it to ng-style="{'font-size': parentSize.width + 'px'}"....

Using Angular to style related CSS

css,angularjs,twitter-bootstrap,ng-style

I solved this by creating a .navbar-rgba-colors class and adding it to the .navbar element. The CSS (LESS) below overrides the relevant bootstrap defaults: .navbar-rgba-colors { border-color: rgba(0,0,0,0.2); .navbar-nav > li > a, a.navbar-brand { opacity: 0.7; } .navbar-nav > li:hover > a, .navbar-nav > li > a:focus, .navbar-nav >...

Angular TypeError: name.replace is not a function for ng-style

angularjs,ng-style

Your potential issue is due to the incorrect usage of ng-style. ng-style sets a watcher on the expression and sets the element's style with the help of jquery/jqlite element.css. And Inside element.css css attribute (name) is converted to the standard camel casing (which uses regex string replace). In your specific...

How to change style on change with AngularJS? [duplicate]

angularjs,ng-style

The code you posted doesn't work properly because when an update comes, the directives is not able to understand that the value has changed and so, it doesn't update the stlye attribute. The reason is that the ngStyle directive just take variables within it, such as: ng-style="topStyle" With topStyle as:...

AngularJS: setting background color dynamically

javascript,html,css,angularjs,ng-style

You can achieve this by ng-class conditional operator <tr ng-repeat="log in logs" class="logentry" ng-class="{ 'ERROR': 'severity-error', 'MESSAGE': 'severity-message'}[log.severity]"> <td>{{log.timestamp}}</td> <td>{{log.severity}}</td> <td>{{log.message}}</td> </tr> CSS .severity-error { background-color: red; } .severity-message { backgroud-color: green; } ...