Customize AngularJS ng-style

May 17, 2015

Reading time ~1 minute

Basic Usage

You can set style value using scope.

<div image class="image" ng-style="{'background-image': 'url(' + backimg + ')'}">
$scope.backimg = 'XXXXX' // image url

You can switch style value using expression.

<div image class="image" ng-style="{ 'width': isMobile: ? '200px': '300px' }">
$scope.isMobile = true // switch value to change style

Customize Usage

How to change style propertry and value using expression

<div image class="image" ng-style="getStyle(ua)">
$scope.getStyle = function(ua){
  if(ua.match(/Android/i)){
    return { display: 'none' };
  }else{
    return { width: '300px': height: '300px' };
  }
}

add ticket number to git commit automatically

Most of ticket tracker like Github, pivotal tracker have function to connect your commit to ticket(story).But every time when you commit ...… Continue reading

I will build frontend and backend separately

Published on September 28, 2016

order of angular controller's initialisation

Published on October 05, 2015