Angular.js method tutorial

The development of front-end technology is so fast, various excellent technologies, the emergence of excellent framework is simply fascinating, keeping up with the trend of the times, learning to master new knowledge is naturally Dare to neglect. Recently, I have learned angular.js, share some of my experience skills to you. Here, this article will introduce you related information about Angular.js in the in-array operation, and don’t say more, let’s take a look at the detailed introduction.

1: Ng-Click, Ng-Model, Ng-bind, Ng-Class, Ng-Hide, Ng-App

2: PlaceHolder,

3: { } Add code “: true | false”, use commas separated, can control features including styles, display and hidden,}

1, the creation of arrays

 VAR arrayobj = new array (); // Create an array var arrayobj = new array ([size]); // Create an array and specify the length, notice that the upper limit is the length VAR Arrayobj = New Array ([Element0 [, Element1 [, ... [, Elementn]]]); // Create an array and assign a value   


 VAR TestGetarrValue = arrayobj [1]; // Get an array of element values ​​arrayobj [1] = "This is a new value" // / 12 数][[[[[[[[[[[[[[[[[ ArrayObj. Push ([item1 [item2 [.]); // Add one or more new elements to the end of the array and returns the new length Arrayobj.unshift ([Item1 [item2 [. " [ITEMN]]]]); // Add one or more new elements to the array start, the elements in the array are automatically moved, returned to the new length Arrayobj.Splice (ITEM2 [ITEM1 [ITEM2 [, ..................................... ..  
4, deletion of array elements

Arrayobj.POP (); // Remove the last element and return this element value arrayobj.shift (); // remove the first element and return this element value, an array automatically moves Arrayobj.SPLICE (deletePos, deletecount); // Delete from the specified location DeletePos starts the specified number of deletecount, the array forms return the removed element
5, the interception and merge of the array

ArrayObj.slice (start, [end]); // Returns a part of the array in the form of an array, pay attention to the elements corresponding to the END, if the end will be omitted all elements after the start is copied Arrayobj.concat ([item1 [, item2 [,….. [, itemn]]]); // Connect multiple arrays (also a string, or mixing of the array and string) to an array, Returns new arrays
  6, the copy  

ArrayObj.slice (0); // Returns the copy array of arrays, pay attention Is a new array, not pointing arrayobj.concat (); // returns a copy array of array, pay attention to a new array, not pointing

arrayobj.reverse (); // reverse element (the first to the last, the last row to the forefront), return array Address Arrayobj.Sort (); // Sort array element, return an array address
  8, character string of array elements  

ArrayObj.join (Separator); // Returns the string, which connects each element value of the array, separated by Separator.

TOLOCALESTRING, TOSTRING, VALUEOF: It can be seen as a special usage of Join, not commonly used
  3 attributes of array objects  
1, the Length property, the length attribute represents the length of the array, that is, the number of elements. The index is always started by 0, so the upper and lower limits of an array are: 0 and Length-1, respectively.
2, prototype attribute

Returns a reference to the object type prototype. The Prototype property is Object.

 ObjectNameThe parameter is the name of the object object.  3, constructor attribute  
shows a function of creating an object.

Object.constructor // Object is the name of the object or function.


The above is all of this article, I hope this article is to take or work to everyone. To help, if you have any questions, you can leave a message, thank you for your support for Tumi Cloud

© Copyright Notice
Just support it if you like
comment Grab the couch

Please log in to comment