angularbind – AngularJS Bind Function – Angular Binding Examples

here angular.bind Returns a function simple all the function which calls function fn syntax bound to self means this (self make the this for fn). we can provide optional args or param that are unbound(prebound) to the angularjs function. This feature support is also known as all the data partial web-application, as and other way to the distinguished from javascript function currying.angular.bind – AngularJS Bind Function – Angular Binding Examples

angular.bind Syntax(uses)

angular.bind(self, fn, [yourargs]);

Arguments for angular.bind

1.self – Context which fn would be evaluated in.
2.fn – Function or method to be bound.
3.yourargs – Optional arguments to be prebound (conditions) to the fn function call.

READ :  AngularJS AutoComplete Search Dynamic Data using Web API

AngularJS bind directive or function is used to HTML bind the current data or context to a functionangular.bind

Simple Data binding module in AngularJS is the all the data synchronization between the model level and the view.“AngularJS Bind Function”

HTML View using bind

 <p></p> 

Angular.bind will all the bind to a function used to angular.bind which call another all the javascript function and arguments will multiple param also passed from addData

AngularJS Bind Function with http Request Example

$http.get('www.infinityknow.com/api/index.php/getdata').then(angular.bind(this, 
function(response) { 
	this.response = response; //simple use this (which is all the bound data context) 
});

Example

AngularJS Bind Function Example – 1



    <title>AngularJS Bind Function Example</title>
    
	
    var infinityApp = angular.module("infinityApp", []);
    infinityApp.controller('liveCtrl', ['$scope', function ($scope) {
        $scope.first = 50;
        $scope.liveValue = function () {
            var addData = angular.bind(this, function (a, b) {
                return a + b;
            });
            $scope.Add = addData(10, $scope.first);
        }
    }]);
 



<h2>angularbind - AngularJS Bind Function</h2>
    <div>
	<p>Please Enter your Value</p>
        
        Addition={{Add}}
    </div>


Example

READ :  Angular count array of total items in object

AngularJS Bind Function – angular.bind() Example

        
        
 <!-- www.infinityknow.com -->        
<title>AngularJS $scope.bind() Example</title>        
   
  
  var app = angular.module('infinityknowApp', [])            
     app.controller('liveCtrl', ['$scope', function($scope) { 
       $scope.Name = "";
       $scope.respnose = "";
      var greet = function (greeting, punctuation) {
        $scope.respnose = greeting + ' ' + $scope.Name +''+ punctuation;
      };
       $scope.callliveBind = function () {
        var bound = angular.bind(this, greet, 'Welcome');
         bound('!!!!!');
      };
     }]);        
        
        
        
  <fieldset style="background-color:yellow">          
    <legend>Simple AngulerJS $scope.bind() easy Example</legend>          
<div>        
<p style="font-family:Arial;color:pink;background:green;padding:4px;width:150px">{{respnose}}</p>
  
         
    <button>Call Bind</button> 
      </fieldset>