Angular.bind (self, FN, args)
- Function: Returns a new function that binds this function to the self
- Parameters:
- Self: The context object for the new function
- fn: Functions that need to be bound
- Args: Arguments passed to a function
Return value: This new function that points to self
varobj ={name:' xxx ', Print:function(country) {Console.log ( This. Name + ' is form ' +country); }};varSelf ={name:' YYY '};varBINDFN = Angular.bind (self, obj.print, ' China ');//var bindfn = Angular.bind (self, obj.print, [' China ']);Obj.print (' American ');//$ xxx is form AmericanBINDFN ();//$ yyy is form China
Note: Bind depends on your parameter type to invoke call or apply, so args can be a data or an array.
Angular.copy (source, [destination])
- function: Deep copy of Object
- Parameters:
- Source: Origin Object
- Destination: Copied objects
Return value: The copied object
var obj = { ' xxx ', +}; var copyobj =//$ Object {name: "xxx", age:50}
Angular.equals (O1, O2)
Angular.extend (DST, SRC)
- Role: Expansion of objects
- Parameters:
- DST: An Extended object
- SRC: Source Object
Return value: Extended Object
var dst = {name: ' xxx ', Country: ' China '}; var src = {name: ' yyy ', age:10//$ Object {name: "yyy", age:10}//
$ Object {name: "yyy", Country: "China", age:10}
Angular.foreach (obj, iterator, [context])
- Role: Traversal of objects
- Parameters:
- Obj: Object
- Iterator: Iterative functions
- Context: Contexts in an iterative function
return value: obj
varobj = {name: ' xxx ', Country: ' China '};angular.foreach (obj,function(value, key) {Console.log (key+ ': ' +value);});//$ name:xxx//$ Country:chinavarArray = [' xxx ', ' yyy '];angular.foreach (Array,function(item, index) {console.log (index+ ': ' + item + ' form ' + This. Country);}, obj);//$0:xxx Form China//$1:yyy Form China
Angular.fromjson (String)
- Function: String to JSON object
- Parameters:
Return value: JSON object
var json = Angular.fromjson (' {' name ': ' xxx ', ' age ': ' + '//$ Object {name: ' xxx ', age:34}
Angular.tojson (Json,pretty)
- Function: JSON object to String
- Parameters:
- Json:json
- Pretty:boolean number control string output format
-
return value: String
Angular.tojson ({name: ' xxx ' // $ "{" name ":" XXX "}" angular.tojson ({name: ' xxx '},true Span style= "color: #000000;" >); // $ "{ $ " Name ":" XXX " // $}" angular.tojson ({name: ' xxx '},10 // $ "{ $ "Name": "XXX" // $} "
Angular.identity (value)
Angular.isarray (value)
Angular.isdate (value)
angular.isdefined (value)
- Function: Determine whether a data is a defined type
- Parameters:
Return Value: Boolean
// $ false // $ true
angular.isundefined (value)
- Function: Determine whether a data is a undefined type
- Parameters:
Return Value: Boolean
// $ true // $ false
Angular.isfunction (value)
Angular.isnumber (value)
Angular.isobject (value)
Angular.isstring (value)
Angular.lowercase (String)
Angular.uppercase (String)
Angular.noop ()
Angularjs Learning Notes-tool methods