最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

為了賬號(hào)安全,請及時(shí)綁定郵箱和手機(jī)立即綁定

Angular入門

標(biāo)簽:
AngularJS

Environment

Install node and npm first. Then install angular.

npm install -g @angular/cli
ng new my-first-app
cd my-first-app
ng serve

-g means global in your system.
ng new means creating a new project.
ng serve means starting the application in port 4200.

Editing the app

The package structure

package.json has all the dependencies we need in this project.
e2e is end-to-end testing.
node_modules is the package that the dependencies installed in.
In the src->app folder, app.component.html is the html file that displayed in the browser.

The entrance of the program is always index.html in the root fold. Inside it, there is a tag called app-root, which
will be replaced by the angular project.

In the app.component.ts file, there is an annotation @Component which includes a selector, app-root. I think this
will replace the original index.html file with the template file app.component.html. We defined the title in this
class, so we can use it in the template html file.

Modify the files

We can modify the app.component.html file as we like. Add an input, and use a directive [(ngModel)]="name" to bind
this input with the name that we defined in our component class. Additionally, we need to import the module that is
needed for a input, which is the form module.

In the app.modules.ts file:

import { FormsModule } from '@angular/forms';

Then add the FormsModule in the imports array:

imports: [
    BrowserModule,
    FormsModule
]

Installing bootstrap locally in this project

npm install --save bootstrap@3

This command will download bootstrap and save it inside the node_modules folder.

To make angular aware of this, we have to also modify the angular.json file. There is already a style configuration
in this file

"styles": [
  "src/styles.css"
],

This points to the css file in the root, which is used globally. We need to add the bootstrap above it.

"styles": [
  "node_modules/bootstrap/dist/css/bootstrap.min.css",
  "src/styles.css"
],
  • To make this change take effect, run ng serve to restart the server.
點(diǎn)擊查看更多內(nèi)容
TA 點(diǎn)贊

若覺得本文不錯(cuò),就分享一下吧!

評(píng)論

作者其他優(yōu)質(zhì)文章

正在加載中
  • 推薦
  • 評(píng)論
  • 收藏
  • 共同學(xué)習(xí),寫下你的評(píng)論
感謝您的支持,我會(huì)繼續(xù)努力的~
掃碼打賞,你說多少就多少
贊賞金額會(huì)直接到老師賬戶
支付方式
打開微信掃一掃,即可進(jìn)行掃碼打賞哦
今天注冊有機(jī)會(huì)得

100積分直接送

付費(fèi)專欄免費(fèi)學(xué)

大額優(yōu)惠券免費(fèi)領(lǐng)

立即參與 放棄機(jī)會(huì)
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)

舉報(bào)

0/150
提交
取消