Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to get started with angular.js quickly

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article introduces the relevant knowledge of "how to get started with angular.js quickly". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

What is angular.js?

To be exact, angular.js should not be a framework, but a js library, a further encapsulation that relies on jQuery, removes tedious DOM operations, and uses a data-driven MVC modularization library.

When it comes to the word MVC here, it is not very clear. My own understanding is that M is actually a Module module, an .html is a module, V is actually those DOM elements in our .html, and C is what we use to operate V those js scripts.

I probably made a simple sketch:

I do not know whether it is right, if not, please all bosses, put forward valuable suggestions, so that I have a greater promotion, thank you.

Why use angular.js

Well, I have to complain, why Mao still uses angular.js, why Mao doesn't use angular2, at least let me get started with ts.

One of the key reasons for using this js library is that tedious DOM operations can be removed.

It is very efficient to develop using a data-driven view.

How to use angular.js

Ng-app loads an entry application module

Var app = angular.module ('ngApp', [])

Somewhat similar, the let app of the Vue project = new Vue ()

Ng-init initialization data

It is somewhat similar to the data () attribute in Vue.

Ng-controller controller

Var app = angular.module ('ngApp', []) var controller app.controller (' ngController', function ($scopr) {})

Ng-bind data binding

Somewhat similar to v-bind in Vue

Bidirectional binding of ng-model data

Somewhat similar to v-model in Vue

Ng-repeat data cycle

Somewhat similar to v-for in Vue

Use ng-repeat to loop the array

{{x}}

Ng-if adds selection to HTML. The current element is added to the DOM tree only when the expression value is true.

Somewhat similar to v-if in Vue

Ng-show is a bit like v-show.

Ng-src is a bit similar: src

Ng-click is a bit like @ click

Ng-style is a bit similar: style

Ng-class is a bit similar: class

Ng-show/ng-hide is somewhat similar to show (), hide () in jq.

Ng-disabled is a bit similar: disabled

Ng-checked is a bit similar: checked

$scope is somewhat similar to the data () attribute in Vue

Filter filter, somewhat similar to filter in Vue

$scope.$watch is somewhat similar to the watch property in Vue

This is the end of "how to get started with angular.js". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report