Skip to main content

Estou tentando consumir os dados de uma api teste baseada em Laravel, mas estou obtendo o seguinte erro:

Can't bind to 'users' since it isn't a known property of 'app-user'.

USERCOMPONENT

import { Component, OnInit, Input } from '@angular/core';
import { User} from './user';
import { UserService } from './user.service';
@Component({
selector: 'app-user',
   templateUrl: './user.component.html',
   styleUrls: ['./user.component.css']
})
export class UserComponent implements OnInit {
   users: User[]
constructor(private userService: UserService) {
}
ngOnInit() {
   this.listarUsuarios();
}
   listarUsuarios(): void{
   this.userService.listaUsararios().subscribe(users => this.users = users);
}
}

USERSERVICE

import { HttpClient } from "@angular/common/http";
import { Injectable } from "@angular/core";
import { Observable } from "rxjs";
import { User } from "./user";
const API = 'http://localhost:8000/api/user/users';
@Injectable({ providedIn: 'root' })
   export class UserService {
   constructor(private http: HttpClient) {
   } 

   listaUsararios(): Observable<User[]> {
      return this.http.get<User[]>(API);
   }
}

USERMODULE

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { HttpClientModule} from '@angular/common/http';


import { UserComponent} from './user.component';
import { UserServices } from './user.services';

@NgModule({
  declarations: [
    UserComponent,
  ],
  imports: [
    CommonModule,
    HttpClientModule

  ],
  exports:[
    UserComponent,
  ],

  providers:[ 
   UserServices
  ]
})

export class UserModule { }


USERINTERFACE

export interface User {
   id: number,
   name:string,
   email: string,
   telefone:string
   datascimento: Date,
}

APP.COMPONENT.HTML

<app-home></app-home>
<app-user></app-user>

Alguém sabia me ajudar nessa situação, estou iniciando no Angular.

Estou tentando consumir os dados de uma api teste baseada em Laravel, mas estou obtendo o seguinte erro:

Can't bind to 'users' since it isn't a known property of 'app-user'.

USERCOMPONENT

import { Component, OnInit, Input } from '@angular/core';
import { User} from './user';
import { UserService } from './user.service';
@Component({
selector: 'app-user',
templateUrl: './user.component.html',
styleUrls: ['./user.component.css']
})
export class UserComponent implements OnInit {
users: User[]
constructor(private userService: UserService) {
}
ngOnInit() {
this.listarUsuarios();
}
listarUsuarios(): void{
this.userService.listaUsararios().subscribe(users => this.users = users);
}
}

USERSERVICE

import { HttpClient } from "@angular/common/http";
import { Injectable } from "@angular/core";
import { Observable } from "rxjs";
import { User } from "./user";
const API = 'http://localhost:8000/api/user/users';
@Injectable({ providedIn: 'root' })
export class UserService {
constructor(private http: HttpClient) {
}
listaUsararios(): Observable<User[]> {
return this.http.get<User[]>(API);
}
}

USERMODULE

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { HttpClientModule} from '@angular/common/http';


import { UserComponent} from './user.component';
import { UserServices } from './user.services';

@NgModule({
  declarations: [
    UserComponent,
  ],
  imports: [
    CommonModule,
    HttpClientModule

  ],
  exports:[
    UserComponent,
  ],

  providers:[ 
   UserServices
  ]
})

export class UserModule { }


USERINTERFACE

export interface User {
id: number,
name:string,
email: string,
telefone:string
datascimento: Date,
}

APP.COMPONENT.HTML

<app-home></app-home>
<app-user></app-user>

Alguém sabia me ajudar nessa situação, estou iniciando no Angular.

Estou tentando consumir os dados de uma api teste baseada em Laravel, mas estou obtendo o seguinte erro:

Can't bind to 'users' since it isn't a known property of 'app-user'.

USERCOMPONENT

import { Component, OnInit, Input } from '@angular/core';
import { User} from './user';
import { UserService } from './user.service';
@Component({
selector: 'app-user',
   templateUrl: './user.component.html',
   styleUrls: ['./user.component.css']
})
export class UserComponent implements OnInit {
   users: User[]
constructor(private userService: UserService) {
}
ngOnInit() {
   this.listarUsuarios();
}
   listarUsuarios(): void{
   this.userService.listaUsararios().subscribe(users => this.users = users);
}
}

USERSERVICE

import { HttpClient } from "@angular/common/http";
import { Injectable } from "@angular/core";
import { Observable } from "rxjs";
import { User } from "./user";
const API = 'http://localhost:8000/api/user/users';
@Injectable({ providedIn: 'root' })
   export class UserService {
   constructor(private http: HttpClient) {
   } 

   listaUsararios(): Observable<User[]> {
      return this.http.get<User[]>(API);
   }
}

USERMODULE

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { HttpClientModule} from '@angular/common/http';


import { UserComponent} from './user.component';
import { UserServices } from './user.services';

@NgModule({
  declarations: [
    UserComponent,
  ],
  imports: [
    CommonModule,
    HttpClientModule

  ],
  exports:[
    UserComponent,
  ],

  providers:[ 
   UserServices
  ]
})

export class UserModule { }


USERINTERFACE

export interface User {
   id: number,
   name:string,
   email: string,
   telefone:string
   datascimento: Date,
}

APP.COMPONENT.HTML

<app-home></app-home>
<app-user></app-user>

Alguém sabia me ajudar nessa situação, estou iniciando no Angular.

adicionou 1 caractere ao conteúdo
Fonte Link

Estou tentando consumir os dados de uma api teste baseada em Laravel, mas estou obtendo o seguinte erro:

Can't bind to 'users' since it isn't a known property of 'app-user'.

USERCOMPONENT

import { Component, OnInit, Input } from '@angular/core';
import { User} from './user';
import { UserService } from './user.service';
@Component({
selector: 'app-user',
templateUrl: './user.component.html',
styleUrls: ['./user.component.css']
})
export class UserComponent implements OnInit {
users: User[]
constructor(private userService: UserService) {
}
ngOnInit() {
this.listarUsuarios();
}
listarUsuarios(): void{
this.userService.listaUsararios().subscribe(users => this.users = users);
}
}

USERSERVICE

import { HttpClient } from "@angular/common/http";
import { Injectable } from "@angular/core";
import { Observable } from "rxjs";
import { User } from "./user";
const API = 'http://localhost:8000/api/user/users';
@Injectable({ providedIn: 'root' })
export class UserService {
constructor(private http: HttpClient) {
}
listaUsararios(): Observable<User[]> {
return this.http.get<User[]>(API);
}
}

USERMODULE

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { HttpClientModule} from '@angular/common/http';


import { UserComponent} from './user.component';
import { UserServices } from './userServices';user.services';

@NgModule({
  declarations: [
    UserComponent,
  ],
  imports: [
    CommonModule,
    HttpClientModule

  ],
  exports:[
    UserComponent,
  ],

  providers:[ 
   UserServices
  ]
})

export class UserModule { }


USERINTERFACE

export interface User {
id: number,
name:string,
email: string,
telefone:string
datascimento: Date,
}

APP.COMPONENT.HTML

<app-home></app-home>
<app-user></app-user>

Alguém sabia me ajudar nessa situação, estou iniciando no Angular.

Estou tentando consumir os dados de uma api teste baseada em Laravel, mas estou obtendo o seguinte erro:

Can't bind to 'users' since it isn't a known property of 'app-user'.

USERCOMPONENT

import { Component, OnInit, Input } from '@angular/core';
import { User} from './user';
import { UserService } from './user.service';
@Component({
selector: 'app-user',
templateUrl: './user.component.html',
styleUrls: ['./user.component.css']
})
export class UserComponent implements OnInit {
users: User[]
constructor(private userService: UserService) {
}
ngOnInit() {
this.listarUsuarios();
}
listarUsuarios(): void{
this.userService.listaUsararios().subscribe(users => this.users = users);
}
}

USERSERVICE

import { HttpClient } from "@angular/common/http";
import { Injectable } from "@angular/core";
import { Observable } from "rxjs";
import { User } from "./user";
const API = 'http://localhost:8000/api/user/users';
@Injectable({ providedIn: 'root' })
export class UserService {
constructor(private http: HttpClient) {
}
listaUsararios(): Observable<User[]> {
return this.http.get<User[]>(API);
}
}

USERMODULE

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { HttpClientModule} from '@angular/common/http';


import { UserComponent} from './user.component';
import { UserServices } from './userServices';

@NgModule({
  declarations: [
    UserComponent,
  ],
  imports: [
    CommonModule,
    HttpClientModule

  ],
  exports:[
    UserComponent,
  ],

  providers:[ 
   UserServices
  ]
})

export class UserModule { }


USERINTERFACE

export interface User {
id: number,
name:string,
email: string,
telefone:string
datascimento: Date,
}

APP.COMPONENT.HTML

<app-home></app-home>
<app-user></app-user>

Alguém sabia me ajudar nessa situação, estou iniciando no Angular.

Estou tentando consumir os dados de uma api teste baseada em Laravel, mas estou obtendo o seguinte erro:

Can't bind to 'users' since it isn't a known property of 'app-user'.

USERCOMPONENT

import { Component, OnInit, Input } from '@angular/core';
import { User} from './user';
import { UserService } from './user.service';
@Component({
selector: 'app-user',
templateUrl: './user.component.html',
styleUrls: ['./user.component.css']
})
export class UserComponent implements OnInit {
users: User[]
constructor(private userService: UserService) {
}
ngOnInit() {
this.listarUsuarios();
}
listarUsuarios(): void{
this.userService.listaUsararios().subscribe(users => this.users = users);
}
}

USERSERVICE

import { HttpClient } from "@angular/common/http";
import { Injectable } from "@angular/core";
import { Observable } from "rxjs";
import { User } from "./user";
const API = 'http://localhost:8000/api/user/users';
@Injectable({ providedIn: 'root' })
export class UserService {
constructor(private http: HttpClient) {
}
listaUsararios(): Observable<User[]> {
return this.http.get<User[]>(API);
}
}

USERMODULE

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { HttpClientModule} from '@angular/common/http';


import { UserComponent} from './user.component';
import { UserServices } from './user.services';

@NgModule({
  declarations: [
    UserComponent,
  ],
  imports: [
    CommonModule,
    HttpClientModule

  ],
  exports:[
    UserComponent,
  ],

  providers:[ 
   UserServices
  ]
})

export class UserModule { }


USERINTERFACE

export interface User {
id: number,
name:string,
email: string,
telefone:string
datascimento: Date,
}

APP.COMPONENT.HTML

<app-home></app-home>
<app-user></app-user>

Alguém sabia me ajudar nessa situação, estou iniciando no Angular.

Fonte Link

Uncaught Error: Template parse errors: Can't bind to 'users' since it isn't a known property of 'app-user'

Estou tentando consumir os dados de uma api teste baseada em Laravel, mas estou obtendo o seguinte erro:

Can't bind to 'users' since it isn't a known property of 'app-user'.

USERCOMPONENT

import { Component, OnInit, Input } from '@angular/core';
import { User} from './user';
import { UserService } from './user.service';
@Component({
selector: 'app-user',
templateUrl: './user.component.html',
styleUrls: ['./user.component.css']
})
export class UserComponent implements OnInit {
users: User[]
constructor(private userService: UserService) {
}
ngOnInit() {
this.listarUsuarios();
}
listarUsuarios(): void{
this.userService.listaUsararios().subscribe(users => this.users = users);
}
}

USERSERVICE

import { HttpClient } from "@angular/common/http";
import { Injectable } from "@angular/core";
import { Observable } from "rxjs";
import { User } from "./user";
const API = 'http://localhost:8000/api/user/users';
@Injectable({ providedIn: 'root' })
export class UserService {
constructor(private http: HttpClient) {
}
listaUsararios(): Observable<User[]> {
return this.http.get<User[]>(API);
}
}

USERMODULE

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { HttpClientModule} from '@angular/common/http';


import { UserComponent} from './user.component';
import { UserServices } from './userServices';

@NgModule({
  declarations: [
    UserComponent,
  ],
  imports: [
    CommonModule,
    HttpClientModule

  ],
  exports:[
    UserComponent,
  ],

  providers:[ 
   UserServices
  ]
})

export class UserModule { }


USERINTERFACE

export interface User {
id: number,
name:string,
email: string,
telefone:string
datascimento: Date,
}

APP.COMPONENT.HTML

<app-home></app-home>
<app-user></app-user>

Alguém sabia me ajudar nessa situação, estou iniciando no Angular.