Today, Angular JS has been one of the widely used front-end JavaScript frameworks for designing dynamic web applications. Now, coming to present times,
如今,Angular JS已经成为设计动态Web应用程序的广泛使用的前端JavaScript框架之一。 现在,来到现在
Today, however, if you are looking to create a dynamic web app, then, by all means, you will opt for a company providing Angular2 development services. Let’s see the difference between AngularJS VS. Angular 2 in detail.
但是,今天,如果您想创建一个动态Web应用程序,那么您一定会选择一家提供Angular2开发服务的公司。 让我们看看AngularJS VS之间的区别。 Angular 2详细。
角JS (ANGULAR JS)
AngularJS is a front-end, open-source web application framework based on JavaScript. AngularJS uses HTML as a template in the framework where data & expression are merged to create an expressive environment for developing web apps quickly. AngularJS uses the controller approach where the view communicates using a $scope.
AngularJS是基于JavaScript的前端,开源Web应用程序框架。 AngularJS使用HTML作为框架中的模板,在该框架中,数据和表达式被合并以创建用于快速开发Web应用程序的表达性环境。 AngularJS使用控制器方法,其中视图使用$ scope进行通信。
![Image for post](https://img-blog.csdnimg.cn/img_convert/2681b57acd34bd5c613cfa93d3972761.png)
- AngularJS was released by Google in the year 2010. AngularJS在2010年由Google发布。
AngularJS JavaScript-based framework for creating SPA.
用于创建SPA的基于AngularJS JavaScript的框架。
- The architecture of AngularJS is based on MVC. AngularJS的体系结构基于MVC。
- AngularJS code can write by using only ES5, ES6, and Dart. 只能使用ES5,ES6和Dart编写AngularJS代码。
Factory, service, provider, value and constant are used for AngularJS services.
工厂,服务,提供者,值和常量用于AngularJS服务 。
- AngularJS still can be supported but no longer will be developed. AngularJS仍然可以被支持,但是将不再被开发。
- AngularJS was developed based for web development. AngularJS是基于Web开发而开发的。
- Ng-app and angular bootstrap functions are used to initialize. Ng-app和angular bootstrap函数用于初始化。
- AngularJS Run on only client AngularJS仅在客户端上运行
Angular JS的主要功能 (Angular JS Top Features)
MVC框架 (MVC Framework)
MVC stands for model view controller architecture of AngularJS is dynamic in nature. Here Model covers the data & logic part of the application, View covers the aesthetics of the app, the controller connects these two, & enables the apps to function together as a whole. That’s why all the components are built separately & combined later.
MVC代表AngularJS的模型视图控制器体系结构本质上是动态的。 这里的Model涵盖了应用程序的数据和逻辑部分,View涵盖了应用程序的美观性,控制器将这两者联系在一起,并使应用程序能够作为一个整体发挥作用。 这就是为什么所有组件都单独构建并随后组合的原因。
用户界面 (User Interface)
For creating user interface, AngularJS use basic HTML tags.
为了创建用户界面, AngularJS使用基本HTML标签。
减少编码,做更多 (Code Less, Do More)
One of the biggest benefits AngularJS provides you is less code required for creating the same functionality with AngularJS than with the jQuery libraries and data binding is a strong reason behind this.
AngularJS为您提供的最大好处之一就是,与使用jQuery库相比,使用AngularJS创建相同功能所需的代码更少,而数据绑定正是其背后的强大原因。
![Image for post](https://miro.medium.com/max/9999/1*qU9jJEPirY5hNrgNYgjERQ.png)
表达方式 (Expressions)
Two-way data binding: This helps in creating synchronization between the model and the view. The changes made in the model gets instantly reflected in the view, and the changes in the view get instantly reflected in the models. This is useful in creating SPAs.
双向数据绑定:这有助于在模型和视图之间创建同步。 在模型中所做的更改会立即反映在视图中,而在视图中的更改会立即反映在模型中。 这在创建SPA时很有用。
Generally, AngularJS expressions are written inside two curly braces. {{expression}} which are used for two way data binding.
通常, AngularJS表达式写在两个花括号内。 {{expression}}用于双向数据绑定。
过滤 (Filter)
AngularJS filter helps in creating the pagination system that filters the data array with respect to the given parameters. For example, suppose there is a data array that contains all the natural numbers less 7 i.e. [1, 2, 3, 4, 5, 6, 7].
AngularJS过滤器有助于创建分页系统,该分页系统针对给定参数过滤数据数组。 例如,假设有一个数据数组,其中包含所有自然数减去7,即[1、2、3、4、5、6、7]。
Now suppose a filter is applied that allows only numbers less than 6 to be added to the resultant array. Therefore, the resultant array will be [1, 2, 3, 4, 5]. This is possible by using the AngularJS filters.
现在假设应用了一个过滤器,该过滤器仅允许将小于6的数字添加到结果数组中。 因此,结果数组将为[1,2,3,4,5]。 这可以通过使用AngularJS过滤器来实现。
减少编码,做更多 (Code Less, Do More)
One of the biggest benefits AngularJS provides you is less code required for creating the same functionality with AngularJS than with the jQuery libraries and data binding is a strong reason behind this.
AngularJS为您提供的最大好处之一就是,与使用jQuery库相比,使用AngularJS创建相同功能所需的代码更少,而数据绑定正是其背后的强大原因。
角度2 (ANGULAR 2)
Angular2 is the next version of AngularJS, but it’s a complete rewrite of Angular counterpart and uses the component-based approach. Angular 2 is used for developing HTML and JavaScript web apps.
Angular2是AngularJS的下一个版本,但它是对Angular副本的完整重写,并使用基于组件的方法。 Angular 2用于开发HTML和JavaScript Web应用程序。
![Image for post](https://img-blog.csdnimg.cn/img_convert/94b8435028efd4f119b167ef847c3a9c.png)
- Angular2 Released in Sept 2016. Angular2于2016年9月发布。
- The class is the only method to define services in Angular2. 该类是在Angular2中定义服务的唯一方法。
Angular2 is a complete re-write of the AngularJS version.
Angular2是对AngularJS版本的完整重写。
- Angular2 runs on both client-side & server-side. Angular2在客户端和服务器端均运行。
- The architecture of Angular 2 is based on service/controller. Angular 2的体系结构基于服务/控制器。
- Angular 2 is a mobile-oriented framework. Angular 2是面向移动的框架。
- You can use ES5, ES6, and Typescript to write an Angular 2 code. 您可以使用ES5,ES6和Typescript编写Angular 2代码。
- The controllers are replaced by components, and Angular2 is completely component-based. 控制器被组件取代,Angular2完全基于组件。
bootstrapmodule () function is used to initialize.
bootstrapmodule()函数用于初始化。
- Its updated version regularly released because of Semantic Versioning. 由于语义版本控制,其更新版本会定期发布。
Angular 2主要功能 (Angular 2 Top Features)
移动开发 (Mobile Development)
Angular 2 is helpful in developing responsive mobile applications.
Angular 2有助于开发响应式移动应用程序 。
性能 (Performance)
The dynamic loading feature helps in reducing the load time and makes the performance better.
动态加载功能有助于减少加载时间并提高性能。
路由 (Routing)
Features like location service and navigational model has improved the routing service in Angular 2.
位置服务和导航模型等功能改进了Angular 2中的路由服务。
跨平台 (Cross-Platform)
Angular 2 applications can be run on all the devices and platforms like android, iOS, Windows, etc.
Angular 2应用程序可以在所有设备和平台(如android,iOS,Windows等)上运行。
浏览器支持 (Browser Support)
Angular 2 supports all modern browsers like Google Chrome, Safari, Edge, etc.
Angular 2支持所有现代浏览器,例如Google Chrome,Safari,Edge等。
结论 (CONCLUSION)
The above comparison clearly shows that while Angular2 is at an edge over its elder sibling, the former is still not out of the game completely. Do let us know which one you will like to prefer over others and why?
上面的比较清楚地表明,虽然Angular2在其上级兄弟中处于优势地位,但前者仍未完全退出游戏。 是否让我们知道您更喜欢哪一个?为什么?
翻译自: https://medium.com/@shivlab/angularjs-vs-angular-2-whats-the-difference-4e8d325aeeec