dart - How to get ngForm variable reference in the component class -


given following...

.html

<form (ngsubmit) = "onsubmit()"           #heroform = "ngform">       {{diagnostic}}       <div class = "form-group">         <label = "name">name</label>         <input type = "text"                class = "form-control"                required                [(ngmodel)] = "model.name"                ngcontrol = "name"                #name = "ngform"                #spy>         <p *ngif = "name.dirty"            class = "alert alert-danger">           name required         </p>         <!--<p [hidden] = "name.dirty"-->            <!--class = "alert alert-danger">-->           <!--name required-->         <!--</p>-->       </div> 

..

..is possible #name = "ngform" (ngform) reference in .dart component allow manipulation? suggestion , correction welcome.

import -

import {viewchild} 'angular2/core'; 

just add field annotation class

@viewchild('heroform') ngform heroform; 

you can't use in constructor though because set later. in ngafterviewinit or event handlers user input can use without limitations.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -