資源描述:
《angular 2.0 forms》由會員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在學(xué)術(shù)論文-天天文庫。
1、Angular2.0:FormsThis?document?is?published?to?the?web?as?part?of?the?public?Angular?Design?Docs?folderObjectiveAngular?1.x?uses?twoway?data?bindings?to?get?data?from?the?DOM.?This?can?create?cycles?in?the?change?detection?graph,?which?results?in?the?following?proble
2、ms:●It?is?difficult?to?reason?about?the?data?flow?in?the?application?and?understand?which?components?can?affect?which?values.●The?framework?has?to?run?digest?multiple?times,?which?is?not?performant.●Because?of?multiple?digests,?it?is?impossible?to?determine?and?noti
3、fy?the?component?that?the?model?is?stable.?This?is?because?notification?can?further?change?data,?which?can?restart?the?binding?process.●The?framework?cannot?set?all?the?bindings?on?a?parent?element?before?processing?its?children,?which?makes?implementing?certain?pat
4、terns?very?difficult.●The?framework?is?harder?to?learn.?The?developer?has?to?think?about?the?digest?cycle.?●Since?the?order?of?updates?is?not?well?defined,?troubleshooting?certain?types?of?problems?is?challenging.Instead?of?a?generic?mechanism?for?twoway?data?bindin
5、gs,?Angular?2?can?have?a?more?constrained?API?for?getting?data?from?the?DOM?as?a?remedy?for?these?issues.ProposedDesign●FormControl,?FormControlGroup,?FormControlArray?are?three?basic?primitives?for?constructing?forms.?●FormBuilder?provides?a?DSL?making?form?declara
6、tion?more?concise.?FormBuilder?creates?FormControl,?FormControlGroup,?FormControlArray.?●Forms?can?be?declared?in?the?template?of?a?component.?This?creates?FormControl,?FormControlGroup,?FormControlArray.Even?though?most?developers?will?use?FormBuilder?or?will?decla
7、re?their?forms?in?the?template,?most?examples?in?the?document?use?FormControl,?FormControlGroup,?FormControlArray?directly.?This?is?to?make?the?examples?more?explicit.SimpleForms
newFormControl("login"),newFormControl("password"