-1
爲了在角1.XX來引導我們如何補救angularJS 2?
ng-app ="myApp"
和js文件,我們寫
var app = angular.module('myApp',[]);
我們如何能夠引導在角2?
爲了在角1.XX來引導我們如何補救angularJS 2?
ng-app ="myApp"
和js文件,我們寫
var app = angular.module('myApp',[]);
我們如何能夠引導在角2?
您可以使用Angular-CLI和以下命令。
npm install -g angular-cli
ng new PROJECT_NAME
cd PROJECT_NAME
ng serve
import {bootstrap} from "angular2/platform/browser";
import {Component} from "angular2/core";
@Component({
selector: 'my-app',
template: '<h1>My application</h1>'
})
class App{}
bootstrap(App);
它來引導你的應用程序最簡單的方法。但好的做法是分離你的組件和引導文件。 查看此視頻小課程:https://egghead.io/lessons/angular-2-say-hello-world-to-angular-2?course=angular-2-fundamentals
你看過https://angular.io/docs/ts/latest/quickstart.html嗎?這比1.x更復雜 –
我會看看這個鏈接。 – Prateik