erro :
Can't bind to 'ng-model' since it isn't a known property of 'select'. ("
<label>Cliente</label>
<select [ERROR ->][(ng-model)]="cliente">
<option *ng-for="let cliente of clientes" [value]="clientes.razao_so"): cadastroUsuarioComponent@26:8
Can't bind to 'ng-forOf' since it isn't a known property of 'option'. ("
<select [(ng-model)]="cliente">
<option [ERROR ->]*ng-for="let cliente of clientes" [value]="clientes.razao_social">{{clientes.razao_social}}</option>
"): cadastroUsuarioComponent@27:16
Property binding ng-forOf not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "directives" section. ("
<select [(ng-model)]="cliente">
[ERROR ->]<option *ng-for="let cliente of clientes" [value]="clientes.razao_social">{{clientes.razao_social}}</"): cadastroUsuarioComponent@27:8 ; Zone: <root> ; Task: Promise.then ; Value: Error: Template parse errors:
Can't bind to 'ng-model' since it isn't a known property of 'select'. ("
<label>Cliente</label>
minha classe que retorna um array para preenchimento:
import {Component} from '@angular/core';
import {Usuarios} from '../usuarios/usuarios.component';
import {Http,Headers} from '@angular/http';
import {Clientes} from '../clientes/clientes.component';
@Component({
selector : 'cadastroUsuario',
templateUrl: './app/cadastroUsuario/cadastroUsuario.component.html'
})
export class cadastroUsuarioComponent {
usuarios:Usuarios = new Usuarios();
clientes:Object[] = [];
http:Http;
constructor(http:Http){
this.http = http;
http.get('/clientes')
.map(res => res.json())
.subscribe(cliente => {
this.clientes = cliente;
console.log(this.clientes);
},erro=> console.log(erro));
}
cadastrar(event){
event.preventDefault();
let headers = new Headers();
headers.append('Content-Type','application/json');
console.log(this.usuarios);
this.http.post("/usuarios",JSON.stringify(this.usuarios),{headers:headers})
.subscribe(()=> {
this.usuarios = new Usuarios();
console.log('Funcionario salvo com sucesso');
});
}
}
Trecho do html que da o erro :
<div class="col-md-4">
<label>Cliente</label>
<select [(ng-model)]="cliente">
<option *ng-for="let cliente of clientes" [value]="clientes.razao_social">{{clientes.razao_social}}</option>
</select>
</div>