angularjs和angular的區別,Angular JS

 2023-10-18 阅读 22 评论 0

摘要:最近有點時間,想系統的學習下angular.會把要做筆記的地方記錄下,方便以后查詢。 Part 1. angularjs和angular的區別,對于一個index.html 包括三部分   1. ng-app = "phonecatApp" 定義了作用域   2. ng-controller = "PhoneListContro

最近有點時間,想系統的學習下angular.會把要做筆記的地方記錄下,方便以后查詢。

Part 1.

angularjs和angular的區別,對于一個index.html

包括三部分

  1. ng-app = "phonecatApp" 定義了作用域

  2. ng-controller = "PhoneListController" 定義了controller

  3. ng-repeat = "phone in phones" 定義了實現

對于app.js

?1.var phonecatApp = angular.module('phonecatApp',[]); 定義phonecatApp module

?2. phonecatApp.controller ('PhoneListController', function PhoneListController($scope) {

  $scope.phones =[...];

}

?

tips:

a.ng-repeat = "phone in phones | filter:query" 用來做fitler

index.html -> define? <phone-list></phone-list>

In app.module.js

'use strict';

// Define the `phonecatApp` module
angular.module('phonecatApp', [
? // ...which depends on the `phoneList` module
? 'phoneList'
]);

In phone-list.module.js


'use strict';

// Define the `phoneList` module
angular.module('phoneList', []);

In phone-list.component.js

'use strict';

// Register `phoneList` component, along with its associated controller and template
angular.
? module('phoneList').
? component('phoneList', {
??? templateUrl: 'phone-list/phone-list.template.html',
??? controller: function PhoneListController() {
????? this.phones = [
??????? {
????????? name: 'Nexus S',
????????? snippet: 'Fast just got faster with Nexus S.'
??????? }, {
????????? name: 'Motorola XOOM? with Wi-Fi',
????????? snippet: 'The Next, Next Generation tablet.'
??????? }, {
????????? name: 'MOTOROLA XOOM?',
????????? snippet: 'The Next, Next Generation tablet.'
??????? }
????? ];
??? }
? });

?

轉載于:https://www.cnblogs.com/hellocz/p/6088965.html

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/1/146824.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息