Angular 1
v0.9.0 – 21 Oct 2010
v1.0.0 – 14 Jun 2012
Angular 2
2.0.0-alpha.13 – 14 Mar 2015
2.0.0 – 15 Sep 2016
React – 61k ★
Angular 1 – 55k ★
Vue.js – 45k ★
Angular 2 – 21k ★
Ember – 18k ★
Riot – 11k ★
Angular 1
"dependencies": {}
Angular 2
"dependencies": {
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.3",
"rxjs": "^5.0.1",
"zone.js": "^0.7.2" }
Modular standard library for JavaScript. Includes polyfills for ECMAScript 5, ECMAScript 6: promises, symbols, collections, iterators, typed arrays, ECMAScript 7+ proposals, setImmediate, etc. Some additional features such as dictionaries or extended partial application. You can require only needed features or use it without global namespace pollution.
A Zone is an execution context that persists across async tasks. You can think of it as thread-local storage for JavaScript VMs.
C# in browser.
This page is not yet available in JavaScript. We recommend reading it in TypeScript.
Libraries in ts.
Compilation stack.
angular.module('phoneApp').config(['$routeProvider',
function config($routeProvider) {
$routeProvider.when('/phones', {
url: '/phones'
template: ' ',
controller: 'PhonesController',
data: { title: 'Phones' }
}).
otherwise('/404');
}]
);
Routes =
app:
url: '/phones'
template: ' '
controller: 'PhonesController'
data: { title: 'Phones' }
class AppConfig
@$inject: ['$routeProvider']
constructor: ($routeProvider) ->
$routeProvider.when('/phones', Routes.app)
angular.module('phoneApp', []).config(AppConfig)
const appRoutes: Routes = [
{
path: 'phones',
component: PhoneList },
data: { title: 'Phones' }
}
];
@NgModule({
imports: [ RouterModule.forRoot(appRoutes)]
});
Routes = [
{
path: 'phones'
component: PhoneList
data: { title: 'Phones' }
}
]
class AppModule
@annotations: [
new Module({imports: [ RouterModule.forRoot(Routes) ]})
]
var phoneApp = angular.module('phoneApp', []);
phoneApp.controller('PhonesController', ['$scope', function ($scope) {
$scope.phones = [{
'name': 'Nexus S',
'snippet': 'Fast just got faster with Nexus S.'
}];
}]);
class PhonesController
@$inject: ['$scope']
constructor: (@scope) ->
@scope.phones = [{
name: 'Nexus S',
snippet: 'Fast just got faster with Nexus S.'
}]
phoneApp = angular.module 'phoneApp', []
phoneApp.controller 'PhonesController', PhonesController
import { Component } from '@angular/core';
@Component({
selector: 'phone-list',
template: `{{title}}
`
})
export class PhoneList {
title = 'Phones'
phones = [{
name: 'Nexus S',
snippet: 'Fast just got faster with Nexus S.'
}]
}
class PhoneList
@annotations: [
new ng.core.Component
selector: 'phone-list'
template: '{{title}}
'
]
constructor: ->
@title = 'Phones'
@phones = [{
name: 'Nexus S'
snippet: 'Fast just got faster with Nexus S.'
}]
var phoneApp = angular.module('phoneApp', []);
phoneApp.factory('PhoneService', ['$http', function ($http) {
return {
'getById': function (id) {
$http.get('/phones' + id);
}
}
}])
class PhoneService
@$inject: ['$http']
constructor: (@http) -> {}
getById: (id) -> @http.get("/phones/")
phoneApp = angular.module 'phoneApp', []
phoneApp.factory 'PhoneService', PhoneService
import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
@Injectable()
export class PhoneService {
constructor(private http: Http) { }
getById(id: number): {
return this.http.get("/phones/" + id)
}
}
class PhoneService
@parameters: [ ng.http.Http ]
constructor: (@http) -> {}
getById: (id) -> @http.get("/phones/")
var phoneApp = angular.module('phoneApp', []);
phoneApp.filter('reverse', function() {
return function(input, uppercase) {
input = input || '';
var out = '';
for (var i = 0; i < input.length; i++) {
out = input.charAt(i) + out;
}
// conditional based on optional argument
if (uppercase) {
out = out.toUpperCase();
}
return out;
}
});
class ReverseFilter
constructor: () -> return @applyFilter
applyFilter: (input = '', uppercase = false) ->
out = ''
for i in [0..(input.length-1)]
out = input.charAt(i) + out
out = out.toUpperCase() if uppercase
out
phoneApp = angular.module 'phoneApp', []
phoneApp.filter 'reverse', ReverseFilter
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({name: 'reverse'})
export class ReversePipe implements PipeTransform {
transform(value = '', uppercase = false): {
let out = '';
for (var i = 0; i < input.length; i++) {
out = input.charAt(i) + out;
}
// conditional based on optional argument
if (uppercase) {
out = out.toUpperCase();
}
return out;
}
}
class ReversePipe
@annotations: [ new ng.core.Pipe({ name: 'reverse' }) ]
transform: (input = '', uppercase = false) ->
out = ''
for i in [0..(input.length-1)]
out = input.charAt(i) + out
out = out.toUpperCase() if uppercase
out
Angular 1 – 14 Jun 2012
Angular 2 – 15 Sep 2016
Angular ? – March 2017
Semver
Angular