Angular基礎知識

2021-10-08 06:01:08 字數 2060 閱讀 8988

打包:ng build --prod --aot --output-hashing=all

pipe官網鏈結

get format()

get format()與date:format進行資料繫結

template: `

the hero's birthday is }

toggle format

`export class herobirthday2component

toggleformat()

}

把乙個類標記為乙個管道

import  from '@angular/core';

/* * raise the value exponentially

* takes an exponent argument that defaults to 1.

* usage:

* value | exponentialstrength:exponent

* example:

* }

* formats to: 1024

*/@pipe()

export class exponentialstrengthpipe implements pipetransform

}

import  from '@angular/core';

@component(}

`})export class powerboostcalculatorcomponent

tranlate管道使用

@ngx-translate/core

import  from '@angular/core';

import from '../../service/source.service';

import from '@ngx-translate/core';

import from '@angular/common';

import zh from '@angular/common/locales/zh';

registerlocaledata(zh);

import from 'ng-zorro-antd/i18n';

@component()

export class foottitlecomponent implements oninit

public selectlanguage(lang)

if (lang === 'en-us')

}}

http官網鏈結
configurl = 'assets/config.json';

getconfig()

//訂閱

showconfig() );

}

指定響應型別

export inte***ce config 

getconfig()

//

route官網鏈結

路由順序:先到先得

activateroute介面使用

1.把activatedroute和parammap匯入到你的元件

import  from '@angular/router';
2.通過把activatedroute的乙個例項新增到你的應用的鉤子函式中來注入它

constructor(

private route: activatedroute,

) {}

3.更新ngoninit()方法來訪問這個activatedroute並跟蹤id引數

ngoninit() );

}

angular的基礎知識

本篇主要介紹下angular裡的一些概念,並且在咱們的小應用上加上點料。模板 動態模板,是動態的,直接去處理dom的,而不是通過處理字串模版 靜態模板 mvc 核心思想實現 資料管理 資料模型model 應用邏輯 控制器controller 資料表現 檢視view 三者的之間的分離。view從mod...

angular路由詳解一(基礎知識)

本人原來是ios開發,沒想到工作後,離ios開發原來越遠,走上了前端的坑。一路走來,也沒有向別人一樣遇到乙個技術上的師傅,無奈只能乙個人苦苦摸索。如今又開始填angular的坑了。閒話不扯了。本人學習是根據官網教程,如果想根據官網教程學習,我建議先把官網的例子先學一遍,路由的路基部分,都是根據這個例...

Angular 4 0之表單基礎知識介紹

這兩天專案中涉及到了表單的內容,於是好好的把angular 4.0中表單的內容看了一下,總結了一些基礎的知識。總結的內容參考了以下 的內容,大佬們總結的很全,很詳細,若想對表單有進一步的加深和理解,請移步 formcontrol 表單控制項,封裝了表單中的輸入,並提供了一些可供操縱的物件 valid...