There are known issues with input elements that behave differently between
browsers (broken in FF)
There is no need to add
directives : [
FORM_DIRECTIVES,
NgForm,
NgIf,
NgFor
]
they are available globally by default since a while
On Friday, April 15, 2016 at 4:57:43 PM UTC+2, Ahmed GMATI wrote:
>
> Hi guys,
>
> I am a newee using Angular 2. I developped some forms with Typesript and
> it is working with Chrome but doesn't with FireFox.
>
> First of all, I tried the "two way" data bindings with both browsers :
> Chrome has a correct behavior but FireFox doesn't take in consideration the
> binding with ngModel.
>
> In addition, the datepicker of bootstrap works well on Chrome and NOT on
> Firefox.
>
>
> Thanks in advance,
>
> *app.component.ts*
>
> import {Component, OnInit, Event} from 'angular2/core';
> import {FORM_DIRECTIVES, NgForm, NgIf, NgFor} from 'angular2/common';
>
>
> import {Types} from './types';
>
> @Component({
> selector: 'my-app',
> templateUrl:'./app/app.component.html',
> directives : [
> FORM_DIRECTIVES,
> NgForm,
> NgIf,
> NgFor
> ]
> })
> export class AppComponent implements OnInit {
>
> field:any;
>
> types:Array<string> = Types;
>
> ngOnInit() {
> this.field= {};
> }
>
> onChange(event:Event) {
> console.log(this.field.type);
> }
> }
>
>
> *app.component.html*
>
> <h1>My First Angular 2 App</h1>
>
>
> <div class="form-group">
> <label class="col-sm-2 control-label"> Select </label>
> <div class="col-sm-4">
>
> <select class="form-control"
> [(ngModel)]="field.type"
> (change)=onChange($event)
> title="Type">
> <option *ngFor="#t of types">{{ t }}</option>
> </select>
> </div>
>
> <hr/>
>
> <label class="col-sm-2 control-label"> Input </label>
> <div class="col-sm-4">
> <input type="text"
> class="form-control input-sm"
> [(ngModel)]="field.type"
> placeholder="type">
> </div>
> </div>
>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.