Posts by Eduardo Vargas • 3,413 points
194 posts
-
1
votes1
answer4510
viewsA: Share data between Angular 6
It has two main ways of sharing a state between two components that have no parent/child relationship. The first would be with Subject behavior with a service injected into the two components…
-
2
votes2
answers1115
viewsA: How to work with Angular ngIF with screen resolution?
Catching width onInit public innerWidth: any; ngOnInit() { this.innerWidth = window.innerWidth; } To keep updated on resize. @HostListener('window:resize', ['$event']) onResize(event) {…
angularanswered Eduardo Vargas 3,413 -
1
votes1
answer73
viewsA: Get problem using google’s Angular API
Value only exists within subscribe because it is asynchronous. try { this.googleGeoService.ObterGeolocalizacao().subscribe(res => { this.googleGeo = res console.log(this.googleGeo); //existe aqui…
-
1
votes1
answer61
viewsA: Export Angular input value
ngOnInit() { this.formulario = this.formBuilder.group({ pesquisa: [''], }) } salvarForm() { const formVal=this.formulario.value; console.log(formVal);…
-
2
votes1
answer238
viewsA: How to implement Primeng Photo Gallery?
Try mapping to the interface it uses in the documentation. else { this.eventos = response.eventos.map(evento=>{ return { source: this.url + 'get-image-evento/' + evento.image , alt:…
angularanswered Eduardo Vargas 3,413 -
2
votes1
answer464
viewsA: Angular Scripts
According to the angular-cli documentation you can install by npm normally and add the angular-cli.json scripts tag. npm install jquery — save angular-cli.json “scripts”: […
-
1
votes1
answer53
viewsA: Reactiveforms Angular
Imagining that your Inputmodels has a value property and a formControlName I would do so using the array’s reduce function: public construirForm(inputs: InputModels[]) { const formMap =…
-
1
votes4
answers259
viewsA: Error While Consuming Api at Angular
Tries to initialize the variable pokemon: Pokemon[]= [] or pokemon: any[]= []
-
0
votes3
answers7675
viewsA: Angular 6 - Ngfor only Supports Binding to Iterables such as Arrays
Try to initialize the Students variable when you declare it: _students:Student[]= [] this.services.getStudents() .pipe(map(student=>student.alunos)) .subscribe(alunos=>this._students=alunos)…
-
0
votes2
answers608
viewsA: How to pass values created by ngFor as function parameter Ionic 3 + Angular + Firebase?
Tries: <ion-input type = "text" [disabled] = "true" [(ngModel)]="p.descricao"></ion-input> Don’t forget to import Formsmodule into the module
-
3
votes1
answer4785
viewsA: Best practices for creating an Angular project
Best practice to generate an angular design according to the documentation and with the angular-cli. To install angular cli globally npm install -g @angular/cli Then to generate the project: ng new…
angularanswered Eduardo Vargas 3,413 -
3
votes2
answers1048
viewsA: How to understand MVC architecture at Angular 4?
Angular does not have an MVC architecture, so if recommended in the style guide would be an architecture by Feature. Overall the template is easy to define with typescript either with classes or…
-
0
votes2
answers85
viewsA: Error in ngModel call
To start the object with an empty value private empresa : IEmpresas = { nome_fantasia : ''; razao_social : ''; cnpj : ''; };
-
0
votes1
answer348
viewsA: Dynamically create HTML Elements at Angular 2
You can do it this way: <p [innerHTML]="post.Texto"></p>
-
2
votes2
answers3335
viewsA: How to disable the button in Angular?
You’re mixing it up Forms template with reactive Forms Here’s a demo what it would be like I’ll show you what the code with the reactive Forms would look like: <form [formGroup]="registerForm"…
angularanswered Eduardo Vargas 3,413 -
2
votes2
answers1585
viewsA: The map property does not exist in type 'Observable <Response>'
From version 5.5 of rxjs the correct way to use operators and the following: import { Observable } from 'rxjs/Observable'; import { Injectable } from '@angular/core'; import { Http } from…
-
1
votes1
answer60
viewsA: Calling filter method Status
Try with the change event in select <mat-form-field class="formulario-full-width"> <mat-select placeholder="País" name="pais" [(ngModel)]="municipioBuscar.paisId" matTooltip="Deve…
angularanswered Eduardo Vargas 3,413 -
1
votes1
answer730
viewsA: Angular application does not run locally on IE?
According to this reply you have to uncomment the polyfills.ts file by default inside the src folder…
-
0
votes2
answers93
viewsA: Call app.service when reloading the page
You can do it by inheritance in which case the header will always be right. @Injectable() export class BannersService extends AppService{ constructor() { super() } getBanners(){ return…
angularanswered Eduardo Vargas 3,413 -
0
votes1
answer114
viewsA: Error in catchError tutorial Tour of Heroes of Angular 6
Try using the of. /** GET heroes from the server */ getHeroes(): Observable<Hero[]> { return this.http.get<Hero[]>(this.heroesUrl) .pipe( tap(heroes => this.log(`fetched heroes`)),…
angularanswered Eduardo Vargas 3,413 -
0
votes1
answer121
viewsA: Activatedroute does not call the service before updating angular page 5
The value will only exist within sbuscribe because it has the http return and equivalent to Promise.then.. ngOnInit() { this.activatedRoute.params.map(params => params['id']) .switchMap(id =>…
-
0
votes1
answer600
viewsA: Child component of other component does not load
Try the following settings: app.routing.module.ts: const appRoutes: Routes = [ { path: '', redirectTo: '/blog', pathMatch: 'full' } { path: 'candidatos', component: CandidatosComponent}, { path:…
-
1
votes1
answer179
viewsA: Dependency injection, Angular
Just put @Injectable() export class MeuService and put the service inside the providers in app.module import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from…
angularanswered Eduardo Vargas 3,413 -
1
votes1
answer632
viewsA: Angular 5 does not redirect to another component
The problem is that you only have one route and need two. app module. import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { HomeComponent }…
angularanswered Eduardo Vargas 3,413 -
1
votes1
answer50
viewsA: Doubts with post method at the angular
You are complicating unnecessarily. Then just subscribe to the function return. httpOptions = { headers: new HttpHeaders({ 'Content-Type': 'application/json' }) constructor(private httpClient:…
-
0
votes1
answer70
viewsA: Can someone help me with the integration of angular 5 with firebase real time?
enviroment.ts export const environment = { production: false, firebase: //copiar o objeto de configuração. apiUrl: suaUrl }; app.modulets. import { AppComponent } from './app.component import {…
-
0
votes2
answers581
viewsA: Multiple GET requests with Angular 4/5
Give a look, my solution would be to use a function that would help you and for a list of urls returns the observables of your requests. Then for each element that has this array of urls I call the…
angularanswered Eduardo Vargas 3,413 -
0
votes1
answer28
viewsA: Angular 4 problem when setting data in the text editor
Each one will have the value of its respective ngModel if you want each one to have a different value you need a varaiavel para por ngmodel for each type [(ngModel)]="descricao1",…
divanswered Eduardo Vargas 3,413 -
0
votes2
answers276
viewsA: Handle data collected through a JSON api
Think like this, dude, when you do hourService.getData an http request and fires when it is completed the Code inside the subscribe and runs(if that’s okay with the request) getHour() {…
-
1
votes1
answer901
viewsA: Boolean in the Angular
The quotes in Formcontrol are the initialization if you leave as quotes it will find that and string tries to set to false at the beginning corretor: new FormControl(false), contrato: new…
-
1
votes2
answers696
viewsA: Angular2-text-Mask
//Oninit this.myForm.controls['telefone'].valueChanges.subscribe(sualogicaaqui)
-
2
votes1
answer319
viewsA: Activation of Angular Formgroup validation
in the boot does so <button [disabled]="myForm.invalid" .../>
-
2
votes1
answer699
viewsA: Doubts of Angular masks
Summarizing the problem was that you were mixing the reactive Forms(formControlName) with the Forms(ngmodel) template. In this case either you create your own mask or look for another library that…
-
1
votes1
answer510
viewsA: Pass variable in *ngIf
*ngIf="input.errors[validacaoExterna] && (input.dirty || input.touched)"
-
1
votes1
answer80
viewsA: Creating and using component at angular 2
You’re not initiating the snackbar, you have to put it in the builder by angular inject it. import { Component } from '@angular/core'; import { MatSnackBar } from '@angular/material'; @Component({…
angularanswered Eduardo Vargas 3,413 -
2
votes1
answer166
viewsA: Error creating an animation between routes using Angular 5
Opa take a look at this tutorial app.componentts. import { Component } from '@angular/core'; import { fadeIn } from '@app/app.transitions'; @Component({ selector: 'app', styleUrls:…
angularanswered Eduardo Vargas 3,413 -
1
votes1
answer126
viewsA: difficulty to list data in angular 4 datatable
ngOnInit() { this.pesquisa(); } //O erro estava que tinha um this extra aqui pesquisa() { this.noticiaService.pesquisar() .subscribe(noticias => this.noticias = noticias); }…
-
1
votes1
answer62
viewsA: How to work with current German at Angular 4?
My suggestion is to only use the reactive form you should not mix Forms template with reactive Forms <label class="center-block">Name: <p-editor [style]="{'height':'320px'}" pInputText…
angularanswered Eduardo Vargas 3,413 -
3
votes1
answer1234
viewsA: Ionic-Native/http emits error "Nullinjectorerror: No Provider for HTTP!"
Take a look at item 2 of the link you posted from the documentation it says you have to add import to the providers of your module. import { HTTP } from '@ionic-native/http'; ... imports: […
-
1
votes1
answer326
viewsA: Bring id on route
Normally this is done as follows: constructor(private route: ActivatedRoute) userId=0; ngOnInit() { this.route.paramMap .subscribe((params: ParamMap) => this.userId=params.get('id')) //id igual…
-
9
votes1
answer1536
viewsA: Directive differences in Angular
ng-for was used in Angularjs or 1.X versions ngFor without the asterisk is wrong and generates an error. The correct way to do it in versions from angle 2.x is with *ngFor, this why the *ngFor as…
angularanswered Eduardo Vargas 3,413 -
4
votes1
answer1103
viewsA: Has some difference between ng-if and *ngIf
The ng-if was used in Angularjs The *ngIf is used in Angular (version 2.x or higher)
angularanswered Eduardo Vargas 3,413 -
1
votes1
answer168
viewsA: Change only one checkbox
You need a variable checked with another clear name for each checkbox. You don’t need a function for that logic. You can do so: <ion-checkbox color="green"…
-
1
votes2
answers155
viewsA: "Click" does not work at the angle
You have to have the function in the Component header.componentts. @Component({ providers: [MenuService], selector: 'app-header', templateUrl: './header.component.html', styleUrls:…
angularanswered Eduardo Vargas 3,413