These are the basic operations you can do with $http: $http.get(): Accepts aURL and optional config object. Performs an HTTP GETrequest. $http.head(): Accepts a URL and optional config object. Performs an HTTP HEADrequest. $http.post(): Accepts a URL, data object, and optional config object. Performs an HTTP POST request. $http.put(): Accepts a URL, data object, and […]
Monthly Archives: June 2015
angular.js: directives
Basic structure: myModule.directive(‘directiveName’, function(){ return { restrict: ‘AE’, replace: true, template: ‘<div class=”{{class}}”>some html, this could also be a reference to an external template. In which case, you can use templateUrl</div>’, link: function(scope, elem, attrs){ // elem is the HTML element the directive was applied to, and attrs are the attributes of the same } […]
bootstrap: the basics
form example here: http://onsubject.com/experiments/angular_playground/#/forms form-horizontal – switch forms to a grid. The class can also be used to create a fast grid for non-form elements
angular.js filters
Creating one: .filter(‘truncate’, function(){ return function(input, limit){ return (input.length > limit) ? input.substr(0, limit)+’…’ : input; }; }) The first argument in the returning function is the input data we are filtering on, we can add any number of arguments after that. See it in action here