ホームページ ウェブフロントエンド jsチュートリアル AngularJS 2.0_AngularJS の新機能は何ですか

AngularJS 2.0_AngularJS の新機能は何ですか

May 16, 2016 pm 03:15 PM
angularjs

AngularJS has become the most popular open source JavaScript framework in the world of web application development. Since its inception, its success has been driven by astounding economic growth and support and adoption from groups – including individual developers, businesses, and communities.

Angular has become a client-side MVW framework (Model-View-Whatever) for building complex single-page applications. It plays an important role in both application testing and application writing while simplifying the development process.

The current version of Angular is 1.3, which is stable and used by Google (the framework maintainer) to support many applications (it is estimated that there are more than 1,600 applications at Google running Angular 1.2 or 1.3). Angular 2.0 was officially announced with the Nigeria conference last October, and the version won't be a complex major update.

Why is Angular 2.0 launched?

Before discussing Angular 2.0 further (estimated release date is late 2015), let us briefly consider the philosophy behind the new version. Angular 2.0 development starts by solving the following problems:

Mobile: The new version will focus on mobile application development. The rationale is that it's easier to handle the desktop side of things, and once the challenges involve mobile (performance, load times), focusing on this aspect will solve the problem.

Modularization: Individual modules will be removed from Angular’s ​​core for better performance. This means you can choose the parts you need.
Modernization: Angular 2.0 will target ES6 and "evergreen" modern browsers (which automatically update to the latest version). This means developers can focus on code relevant to the business domain.

What are the controversies?

There was no mention of a path to migration to version 2.0 at the Nigeria meeting. It also pointed out that jumping to version 2.0 will break the original version 1.3 application and there will be no backward compatibility. Since then the developer community has been rife with uncertainty and speculation, and some developers have begun to question whether it's worth starting a new Angular 1.3 project.

What are the changes?

AtScript

AtScript is a parent set of ES6 and is used to develop Angular 2.0. It is processed by the Traceur compiler (along with ES6) to generate ES5 code and use TypeScript type syntax to generate execution-time assertions, replacing compile-time checks. However, AtScript is not mandatory, and you can still use pure JavaScript/ES5 code instead of AtScript to write Angular applications.

Improve dependency entry (DI)

The basic idea of ​​the dependency injection (Dependency injection) model is that the client class Client does not need to initialize the member variable IServer it depends on by itself, but uses an independent object to create an appropriate implementation class of IServer and assign it to the member variable of the Client. It is particularly beneficial for module development and component isolation. Angular 2.0 will solve this aspect of Angular 1.X. Added missing features such as child injectors and lifetime/scope controls.

Annotations

AtScript provides tools to associate metadata and functionality. This helps in constructing object instances that provide necessary information to the DI library (inspecting relevant metadata when calling a function or creating an instance of a class). It also makes it easy to overload parameter data by providing an annotation.

Child Injectors

A child injector inherits all performance services of its parent class. Depending on the requirements, different types of objects can be called and different scopes automatically covered.

Instance scope

The improved DI library will feature instance scoping, which becomes even more powerful when using Child Injectors and own scope identifiers.

Template and data binding

When developing applications, templates and data binding will go hand in hand.

Dynamic loading

This is a feature missing from the current Angular version, but will appear in Angular 2.0. This will allow developers to add new commands or controllers on the go.

Template

In Angular 2.0, the template compilation process will be asynchronous. Since the code is based on the ES6 module specification, the module loader will load dependencies by simply referencing the component definition.

Commands

There will be three instructions in Angular 2.0:

Component Directives - These will create reusable components via encapsulated logic in JavaScript, HTML, or an optional CSS stylesheet.

Decoration directives - These directives will be used to decorate the element (such as adding a tooltip, or using ng-show/ng-hide to show/hide the element).

Template directives - these will change HTML into reusable templates. The instantiation and embedding of templates into the DOM can be completely controlled by directives. Examples of this include ng-if and ng-repeat.

ルーティング計画

最初の Angular ルーティングは、いくつかの単純な状況を処理するように設計されています。ただし、フレームワークが進化するにつれて、より多くの機能が追加されます。ルーティングはすでに Angular 2.0 で拡張可能であり、次の基本機能が含まれます:

シンプルな JSON ベースのルーティング構成;

構成上のオプションの契約

静的。パラメータ化されたルーティング モード;

URL パーサー;

クエリ文字列をサポートします。

プッシュステータスまたはハッシュチェンジを使用します。

ナビゲーション モデル (ナビゲーション UI を生成します)

ドキュメントのタイトルが更新されました;

404 ルーティング処理

位置情報サービス;

過去の操作。

それでは、Angular 2.0 を新たな高みに引き上げるルーティング機能を見てみましょう:

サルート

サブルーティングは、アプリケーションの各コンポーネントに独自のルートを提供することで、より小さなアプリケーションに変換します。これは、アプリケーション全体の機能セットをカプセル化するのに役立ちます。

画面のアクティブ化

これにより、開発者は一連の can* コールバックを通じてナビゲーションのライフサイクルをより適切に制御できます。

canActivate - 新しいコントローラーへのナビゲーションを許可/ブロックします。

アクティブ化 - 新しいコントローラーへのナビゲーションが成功した場合に応答します。

canDeactivate - 古いコントローラーからのナビゲーションを許可/ブロックします。

非アクティブ化 - 古いコントローラーからのナビゲーションの成功に応答します。

これらのコールバックを使用すると、開発者はブール値またはコマンド (下位レベルの制御用) を返すことができます。

デザイン

このロジックはすべてパイプライン構造を使用して構築されているため、パイプラインに独自のステップを追加したり、デフォルトのものを削除したりすることが非常に簡単になります。さらに、その非同期の性質により、開発者はサーバー リクエストを使用してコントローラーの認証やデータのロードを行うことができますが、これはまだ計画中です。

ログ

Angular 2.0 には、diary.js と呼ばれるログ サービスが含まれます。これは、アプリケーションのどこに時間が費やされたかを測定するのに非常に便利な機能です。

範囲

$scope は Angular 2.0 から削除され、ES6 クラスに置き換えられます。

結論

リリース日が近づくにつれて、Angular 2.0 をめぐる興奮と話題はさらに激化するでしょう。破壊的な変化は良いことなのでしょうか?私たちには知る由もありませんが、明らかに移転計画がないことを考えると、反対派が緊張しているのは当然です。興奮はすぐに伝わってきました。しかし、それがやってくるのですから、私たちにできることは、それを積極的に歓迎することです。

上記のコンテンツは AngularJS 2.0 の新機能を紹介していますので、お役に立てれば幸いです。

このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。

ホットAIツール

Undresser.AI Undress

Undresser.AI Undress

リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover

AI Clothes Remover

写真から衣服を削除するオンライン AI ツール。

Undress AI Tool

Undress AI Tool

脱衣画像を無料で

Clothoff.io

Clothoff.io

AI衣類リムーバー

AI Hentai Generator

AI Hentai Generator

AIヘンタイを無料で生成します。

ホットツール

メモ帳++7.3.1

メモ帳++7.3.1

使いやすく無料のコードエディター

SublimeText3 中国語版

SublimeText3 中国語版

中国語版、とても使いやすい

ゼンドスタジオ 13.0.1

ゼンドスタジオ 13.0.1

強力な PHP 統合開発環境

ドリームウィーバー CS6

ドリームウィーバー CS6

ビジュアル Web 開発ツール

SublimeText3 Mac版

SublimeText3 Mac版

神レベルのコード編集ソフト(SublimeText3)

入門から習得まで、2022 年の最新 5 つの angularjs チュートリアル 入門から習得まで、2022 年の最新 5 つの angularjs チュートリアル Jun 15, 2017 pm 05:50 PM

Javascript は、コードの構成、コードのプログラミング パラダイム、およびオブジェクト指向理論の点で非常にユニークな言語です。しかし、JavaScript が 20 年間主流であったとはいえ、jQuery、Angularjs、さらには React などの人気のあるフレームワークを理解したい場合は、「Black Horse Cloud Classroom JavaScript Advanced Framework」を見てください。デザインビデオチュートリアル」。

PHP と AngularJS を使用して応答性の高い Web サイトを構築し、高品質のユーザー エクスペリエンスを提供します PHP と AngularJS を使用して応答性の高い Web サイトを構築し、高品質のユーザー エクスペリエンスを提供します Jun 27, 2023 pm 07:37 PM

今日の情報化時代において、ウェブサイトは人々が情報を入手し、コミュニケーションを図るための重要なツールとなっています。レスポンシブな Web サイトはさまざまなデバイスに適応し、ユーザーに高品質のエクスペリエンスを提供できます。これは、現代の Web サイト開発のホットスポットとなっています。この記事では、PHP と AngularJS を使用して応答性の高い Web サイトを構築し、高品質のユーザー エクスペリエンスを提供する方法を紹介します。 PHP の概要 PHP は、Web 開発に最適なオープンソースのサーバー側プログラミング言語です。 PHP には、学びやすさ、クロスプラットフォーム、豊富なツール ライブラリ、開発効率など、多くの利点があります。

PHP と AngularJS を使用して Web アプリケーションを構築する PHP と AngularJS を使用して Web アプリケーションを構築する May 27, 2023 pm 08:10 PM

インターネットの継続的な発展に伴い、Web アプリケーションは企業情報構築の重要な部分となり、最新化作業に必要な手段となりました。 Web アプリケーションの開発、保守、拡張を容易にするために、開発者は開発ニーズに合った技術フレームワークとプログラミング言語を選択する必要があります。 PHP と AngularJS は非常に人気のある 2 つの Web 開発テクノロジであり、それぞれサーバー側とクライアント側のソリューションであり、これらを組み合わせて使用​​すると、Web アプリケーションの開発効率とユーザー エクスペリエンスを大幅に向上させることができます。 PHPPHPの利点

Flask と AngularJS を使用してシングルページ Web アプリケーションを構築する Flask と AngularJS を使用してシングルページ Web アプリケーションを構築する Jun 17, 2023 am 08:49 AM

Web テクノロジーの急速な発展に伴い、シングル ページ Web アプリケーション (SinglePage Application、SPA) は、Web アプリケーション モデルとしてますます人気が高まっています。従来の複数ページの Web アプリケーションと比較して、SPA の最大の利点は、ユーザー エクスペリエンスがよりスムーズであり、サーバーのコンピューティング負荷も大幅に軽減されることです。この記事では、FlaskとAngularJSを使って簡単なSPAを構築する方法を紹介します。 Flask は軽量の Py です

PHP と AngularJS を使用してオンライン ファイル管理プラットフォームを開発し、ファイル管理を容易にする PHP と AngularJS を使用してオンライン ファイル管理プラットフォームを開発し、ファイル管理を容易にする Jun 27, 2023 pm 01:34 PM

インターネットの普及に伴い、ネットワークを使用してファイルを転送したり共有したりする人が増えています。ただし、さまざまな理由により、FTP などの従来の方法をファイル管理に使用しても、現代のユーザーのニーズを満たすことができません。したがって、使いやすく、効率的で安全なオンライン ファイル管理プラットフォームを確立することがトレンドになっています。この記事で紹介するオンライン ファイル管理プラットフォームは、PHP と AngularJS をベースにしており、ファイルのアップロード、ダウンロード、編集、削除などの操作を簡単に実行でき、ファイル共有、検索、検索などの一連の強力な機能を提供します。

PHP プログラミングで AngularJS を使用するにはどうすればよいですか? PHP プログラミングで AngularJS を使用するにはどうすればよいですか? Jun 12, 2023 am 09:40 AM

Web アプリケーションの人気に伴い、フロントエンド フレームワーク AngularJS の人気も高まっています。 AngularJS は、Google が開発した JavaScript フレームワークで、動的な Web アプリケーション機能を備えた Web アプリケーションの構築に役立ちます。一方、バックエンド プログラミングの場合、PHP は非常に人気のあるプログラミング言語です。サーバーサイド プログラミングに PHP を使用している場合、PHP と AngularJS を使用すると、Web サイトにさらに動的な効果がもたらされます。

AngularJS の基本の紹介 AngularJS の基本の紹介 Apr 21, 2018 am 10:37 AM

この記事の内容は AngularJS の基本的な入門に関するもので、必要な友人に共有します。

フロントエンド開発に PHP と AngularJS を使用する方法 フロントエンド開発に PHP と AngularJS を使用する方法 May 11, 2023 pm 05:18 PM

インターネットの普及と発展に伴い、フロントエンド開発の重要性がますます高まっています。フロントエンド開発者として、私たちはさまざまな開発ツールとテクノロジーを理解し、習得する必要があります。その中でも、PHP と AngularJS は非常に便利で人気のあるツールです。この記事では、これら 2 つのツールをフロントエンド開発に使用する方法を説明します。 1. PHP の概要 PHP は、人気のあるオープン ソースのサーバー側スクリプト言語であり、Web 開発に適しており、Web サーバーやさまざまなオペレーティング システム上で実行できます。 PHP の利点は、シンプルさ、スピード、利便性です。

See all articles