Tìm hiểu về Angular 2.0
Những thay đổi chính là gì? Component sẽ là một khái niệm trung tâm; nghe vài nhận định rằng web component là tương lai của web, và Ang...
Sẻ Chia Kiến Thức - Tiếp Cận Công Nghệ !
Những thay đổi chính là gì? Component sẽ là một khái niệm trung tâm; nghe vài nhận định rằng web component là tương lai của web, và Ang...
var myApp = angular
   .module("myModule", [])
   .controller("productController", function($scope) {
     var prods = { name: "Prod1", quantity: 1 };
     $scope.products = prods;
});
import{ Component } from 'angular2/core';
@Component({
  selector: 'prodsdata',
  template: `
    <h3>{{prods.name}}</h3> `
})
exportclassProductComponent {
  prods = {  name: 'Prod1', quantity: 1 };
}
ng-app, hai là sử dụng code.angular.element(document).ready(function() {
      angular.bootstrap(document, ['myApp']);
});
ng-app. Chỉ có thể sử dụng bootstrap qua code.import { bootstrap } from 'angular2/platform/browser';
import { ProductComponent } from './product.component';
bootstrap(ProductComponent);
ng-repeat được thay thế bằng *ngFor.<ul>
   <li ng-repeat="technology in technologies">
     {{technology.name}}
   </li>
</ul>
<div ng-if="technologies.length">
   <h3>You have {{technologies.length}} technologies.</h3>
</div>
<ul>
  <li *ngFor="let technology of technologies">
    {{technology.name}}
  </li>
</ul>
<div *ngIf="technologies.length">
  <h3>You have {{technologies.length}} technologies.</h3>
</div>
ng-class bây giờ là ngClass và ng-model bây giờ là ngModel.ng-href, ng-src, ng-show, ng-hide ... Angular 2.x sẽ là href, src, hidden. Các sự viện cũng thay đổi ng-click and ng-blur => (click), (blur).<button ng-click="doSomething()">
<button (click)="doSomething()">
ng-bind, Angular 2.x được thay thế bằng thuộc tính trong ngoặc vuông [property]<input ng-bind="technology.name"></input>
<input [value]="technology.name"></input>
<div [style.color]="color">Some text...</div>
ng-model , nhưng Angular 2 được thay thế bằng [(ngModel)].<input ng-model="technology.name"></input>
<input [(ngModel)]="technology.name"></input>
$routeProvider.when() để cấu hình route. Angular 2, dùng @RouteConfig{(...}). ng-view present in Angular 1.x is replaced with <router-outlet>.npm install angular-cli -g npm cache clean ng new application-name ng new AngularCLIDemoApp ng serve ng build ng test ng generate class Demo ng g component demo-component ng g service demo-service ng g directive demo-directive ng g pipe demo-pipe ng g route test ng g route demo ng g route demo --inline-template --inline-style ng lint ng format
Sự khác nhau giữa Angular 1 và Angular 2 -Được phát triển mới hoàn toàn, ko phải là bản nâng cấp cho angularjs 1.x -Hiện tại đang là ph...
Nhận tải tài liệu vip trên trang tailieu.vn mới nhất 07/2015 Lâu quá Admin 4T mới lục lại acc vip và có một số acc vip tailieu.vn hạn s...
Để đăng ký và verify Paypal mới nhất ( Personal ) ta làm theo hướng dẫn đăng ký tài khoản loại cá nhân ( Personal/Premier ). Nếu bạn cần ...