0

I have to work in a Form with Angular 2, i need a html select but doesn't work i don't find help neither from Angular 2 Documentation, indeed live examples provided doesn't work (i mean HERO FORM). Hero Form Live Example

I don't need get A new selection just I need it works as is shown in Doc. by Angular 2 inside a Form.

Someone Knows what happens about it?.

  • 3
    Welcome to StackOverflow. Please add some code that demonstrates what you have tried, where you failed, what error message you got, ... Check also the help menu about how to ask good questions. – Günter Zöchbauer Apr 18 '16 at 13:23
  • Thanks Günter, you right , i will add more information.Editing. – Guillermo Huidobro Apr 18 '16 at 13:45
  • 1
    Possible duplicate of [How can I get new selection in "select" in Angular 2?](http://stackoverflow.com/questions/33700266/how-can-i-get-new-selection-in-select-in-angular-2) – Mark Rajcok Apr 18 '16 at 15:45
  • Mark Rajcok, thanks for your comments , I see a different problem that involved a documentation by Angular 2. As you can see I have added a link where we see the problem, just I wanna contribute with the community with a doubt & problably solution. Could you answer Why select html does not work in Angular 2 neither in live example HERO FORM ? I 'd appreciate any comments related with the problem. – Guillermo Huidobro Apr 19 '16 at 15:12

1 Answers1

0

I solved it ,I hope works for everyone, if you read , you understand. Thanks StackOverflow , for let help us.

HTML

<div class="form-group">
    <label for="ReclaimType">Choose Reclaim Type</label>
    <div class="input-group">
        <select (change)="getReclaimType($event)"    [(ngModel)]="reclaimType" ngControl="reclaimType" class="form-control">
        <option *ngFor="#reclaimType of reclaim.choiceType" 
[value]="reclaimType">{{reclaimType}}</option>
        </select>
        <span class="input-group-addon"><span class="glyphicon glyphicon-asterisk"></span></span>
    </div>
</div>

Typescript code

reclaimType: string = '';

getReclaimType(event: any) {
    this.reclaimType = event.target.value;
}

private reclaim: any = {
    choiceType: ['Choose...', 'Aguas Servidas', 'Baldio Abierto',        'Residuos Varios', 'Veredas Rotas']
};