Angularjs Getting Started finishing

Source: Internet
Author: User

Before posting a blog post, from the mobile angular UI of the demo and its official website to understand the general use of the whole angularjs, but not very good study, just through some technical blog preliminary understanding, into a lot of pits. So now in the Civil Service network formally organized under the Knowledge point consolidation

  1. Template built-in directives

    Boot program Ng-app

    Set Variable Ng-model

    Get variable {{}}

    Traverse ng-repeat= "row in rows"

    Search function ng-repeat= "row in rows | Filter: Query variable name "

    Sort function ng-repeat= "row in rows | ORDER BY: Sort variable name "

    Picture ng-src= "{{}}"

  2. Angularjs built-in methods
    1. Defined items: Jsgen = Angular.module ("Jsgen", ["Nglocale", "Ngroute", "Nganimate", "Ngresource", "Ngcookies", "Ui.validate", " Gentemplates "," angularfileupload "]);
    2. Initialized: Jsgen.run (["App", "$q", "$rootScope", "$location", "$timeout", "$filter", "GetFile", "Jsonkit", "toast", "timing", " Cache "," Restapi "," sanitize "," Mdparse "," Mdeditor "," Cryptojs "," Promiseget "," myconf "," Anchorscroll "," isVisible "," Applyfn "," Param "," store "," I18n-zh ",
    3. Define constants: Jsgen.constant ("App", {url: ', Version:Date.now ()}
    4. Configure the route: Jsgen.config (["$routeProvider", "$locationProvider",]), configure HttpProvider:jsGen.config (["$httpProvider", " App "]);
    5. Interface services: Jsgen.factory ("Restapi", ["$resource",]), Factory mode: Jsgen.factory ("I18n-zh", ["$locale"]); Cache: Jsgen.factory ("Cache", ["$cacheFactory"]);
    6. Filter: Jsgen.filter ("placeholder", ["Jsonkit"])
    7. define Directive (binding event): Jsgen.directive ("Gentabclick", function () {});
    8. Define controller: Jsgen.controller ("Indexctrl", ["app", "$scope", "$routeParams", "getList"])
Controller controllers for the ANGULARJS
  • Angularjs a built-in service $http
     Myapp.controller (' controller name '   function   = data; }); $scope. Orderprop  = ' age '; //  sort default variable }) 
  • Event handlers
    <class= "btn btn-default"  ng-click= "Testclick (' AA ')"> Click event </button>
    /* *   * Click on the event note. Run () only $rootscope  injected   */function( param) {    alert (param);  }
ANGULARJS Service
' Use strict ';//define the angular module (only defined to be introduced as a dependency package in App.js)//Dependent Ngresource PackagevarServices = angular.module (' Services ', [' Ngresource ']);//. Factory () Factory mode, specifically not in-depth understanding of the study, temporarily follow the demo writeServices.factory (' Newsservice ',       [' $resource ', ' $routeParams ', ' API ',//Controller Access handle    function($resource, $routeParams, API) {return$resource (Api.url+ '/news/:action/:id ',//defining data Request URLs{ }, {getList: {method:' GET ', params:{action: ' Lists '},isarray:true}//News Model Method            }); }]);

Filters for ANGULARJS filter filter
function () {    // return filter method return  function(input) {       ///  return filter result    return input? ' \u2713 ': ' \u2718 ';  }});

    • Angularjs built-in filtering method
      * {{"lower cap string" | uppercase}}
      {{{foo: ' Bar ', baz:23} | json}}
      {{1304375948024 | date}}
      {{1304375948024 | date: ' YYYY-MM-DD HH:mm:ss '}}
{' abc ' |uppercase}}

Results:

Angularjs Getting Started finishing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.