Angular

 Angular


Recently came across this framework.  It lets you do lots of cool things, which are difficult otherwise.

1. Getting javascript object values written to DOM or html field names.

<label  ng-repeat="obj in objCollection" class="radio-inline">    
   <input name="obj" id="obj-{{$index}}" value="{{obj.value}}" ng-model="scopedObj.val" type="radio">     
{{obj.label}}
    <label>

objCollection is the collection of obj objects.  objCollection and scopedObj are both in the scope.

2.  If there an object available in scope , you can directly access it using a URL.


3. similar to jQuery  , you can make ajax calls easily.

        var uri = "http://mydomain/uri";
        var $http = angular.element('html').injector().get('$http');
        $http.get(uri, {
        }).success(function(data,status,headers,config){
                console.log(data);
            }
         ).error(function(data,status,headers,config){
                    console.log(data);
        });        

This is done outside controller. within controller, $http  is available and need to be retrieved explicitly as above.

Comments

Popular posts from this blog

SQL

Analytics

DBeaver