検索
ホームページウェブフロントエンドjsチュートリアルAngularJS 2.0_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 までご連絡ください。
JavaScriptの進化:現在の傾向と将来の見通しJavaScriptの進化:現在の傾向と将来の見通しApr 10, 2025 am 09:33 AM

JavaScriptの最新トレンドには、TypeScriptの台頭、最新のフレームワークとライブラリの人気、WebAssemblyの適用が含まれます。将来の見通しは、より強力なタイプシステム、サーバー側のJavaScriptの開発、人工知能と機械学習の拡大、およびIoTおよびEDGEコンピューティングの可能性をカバーしています。

javascriptの分解:それが何をするのか、なぜそれが重要なのかjavascriptの分解:それが何をするのか、なぜそれが重要なのかApr 09, 2025 am 12:07 AM

JavaScriptは現代のWeb開発の基礎であり、その主な機能には、イベント駆動型のプログラミング、動的コンテンツ生成、非同期プログラミングが含まれます。 1)イベント駆動型プログラミングにより、Webページはユーザー操作に応じて動的に変更できます。 2)動的コンテンツ生成により、条件に応じてページコンテンツを調整できます。 3)非同期プログラミングにより、ユーザーインターフェイスがブロックされないようにします。 JavaScriptは、Webインタラクション、シングルページアプリケーション、サーバー側の開発で広く使用されており、ユーザーエクスペリエンスとクロスプラットフォーム開発の柔軟性を大幅に改善しています。

pythonまたはjavascriptの方がいいですか?pythonまたはjavascriptの方がいいですか?Apr 06, 2025 am 12:14 AM

Pythonはデータサイエンスや機械学習により適していますが、JavaScriptはフロントエンドとフルスタックの開発により適しています。 1. Pythonは、簡潔な構文とリッチライブラリエコシステムで知られており、データ分析とWeb開発に適しています。 2。JavaScriptは、フロントエンド開発の中核です。 node.jsはサーバー側のプログラミングをサポートしており、フルスタック開発に適しています。

JavaScriptをインストールするにはどうすればよいですか?JavaScriptをインストールするにはどうすればよいですか?Apr 05, 2025 am 12:16 AM

JavaScriptは、最新のブラウザにすでに組み込まれているため、インストールを必要としません。開始するには、テキストエディターとブラウザのみが必要です。 1)ブラウザ環境では、タグを介してHTMLファイルを埋め込んで実行します。 2)node.js環境では、node.jsをダウンロードしてインストールした後、コマンドラインを介してJavaScriptファイルを実行します。

クォーツでタスクが開始される前に通知を送信する方法は?クォーツでタスクが開始される前に通知を送信する方法は?Apr 04, 2025 pm 09:24 PM

Quartzタイマーを使用してタスクをスケジュールする場合、Quartzでタスク通知を事前に送信する方法、タスクの実行時間はCron式によって設定されます。今...

JavaScriptでは、コンストラクターのプロトタイプチェーンで関数のパラメーターを取得する方法は?JavaScriptでは、コンストラクターのプロトタイプチェーンで関数のパラメーターを取得する方法は?Apr 04, 2025 pm 09:21 PM

JavaScriptプログラミング、プロトタイプチェーンの関数パラメーターの理解と操作のJavaScriptのプロトタイプチェーンの関数のパラメーターを取得する方法は、一般的で重要なタスクです...

WeChat MiniプログラムWebViewでVUE.JSダイナミックスタイルの変位が失敗した理由は何ですか?WeChat MiniプログラムWebViewでVUE.JSダイナミックスタイルの変位が失敗した理由は何ですか?Apr 04, 2025 pm 09:18 PM

WeChatアプレットWeb-ViewでVue.jsを使用する動的スタイルの変位障害がvue.jsを使用している理由の分析...

TamperMonkeyで複数のリンクの同時GETリクエストを実装し、順番に戻る結果を決定する方法は?TamperMonkeyで複数のリンクの同時GETリクエストを実装し、順番に戻る結果を決定する方法は?Apr 04, 2025 pm 09:15 PM

複数のリンクの同時ゲットリクエストを作成し、結果を返すために順番に判断する方法は? TamperMonkeyスクリプトでは、複数のチェーンを使用する必要があることがよくあります...

See all articles

ホット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ヘンタイを無料で生成します。

ホットツール

AtomエディタMac版ダウンロード

AtomエディタMac版ダウンロード

最も人気のあるオープンソースエディター

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Eclipse を SAP NetWeaver アプリケーション サーバーと統合します。

ゼンドスタジオ 13.0.1

ゼンドスタジオ 13.0.1

強力な PHP 統合開発環境

SecLists

SecLists

SecLists は、セキュリティ テスターの究極の相棒です。これは、セキュリティ評価中に頻繁に使用されるさまざまな種類のリストを 1 か所にまとめたものです。 SecLists は、セキュリティ テスターが必要とする可能性のあるすべてのリストを便利に提供することで、セキュリティ テストをより効率的かつ生産的にするのに役立ちます。リストの種類には、ユーザー名、パスワード、URL、ファジング ペイロード、機密データ パターン、Web シェルなどが含まれます。テスターはこのリポジトリを新しいテスト マシンにプルするだけで、必要なあらゆる種類のリストにアクセスできるようになります。

SublimeText3 中国語版

SublimeText3 中国語版

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