Posts by Eduardo Vargas • 3,413 points
194 posts
-
1
votes1
answer424
viewsA: Problem with routerLink at angle 6
Import the Routermodule in the module that you declare your component and not only in the app module.
-
2
votes1
answer1207
viewsA: Typescript - Error TS1206 Decorators are not Valid here
Annotation of @Component has to be on top of the class of its component and not on top of a template interface.. @Component({ selector: 'app-ServicesMonitoring', templateUrl:…
-
1
votes1
answer31
viewsA: Link breaking by typing directly into the browser
Because your url is one level up instead of your site.com is your site.com/something you have to build so: ng build --base-href=/something/ or in your case ng build --base-href=/checkinexpress/…
-
1
votes1
answer187
viewsA: Route Problem at Angular accessed directly
According to the documentation you have to rewrite a file. Try to rewrite the web.config file <system.webServer> <rewrite> <rules> <rule name="Angular Routes"…
-
1
votes1
answer102
viewsA: Changedetectionstrategy from the Angular
The angular has two types of Changedetectionstrategy the Default and the Onpush. The main difference is that Onpush works only with immutable objects and arrays. That is only if another reference to…
-
0
votes2
answers411
viewsA: Use Angular 2 without Nodejs after build
I can run this app without Nodejs ? If rotating would develop I believe not, but after finished you you can use the ng build command and your files will be generated compiled from there no longer…
-
1
votes4
answers3388
viewsA: Cannot read Property 'name' of Undefined
The error is in the following html: <mat-error *ngIf="formErrors.name"> {{ formErrors.name }} </mat-error> you have not given a property to.…
-
1
votes1
answer52
viewsA: How to assign a Json font within an interface
You need to declare two interfaces and use one inside the other: export interface Compra { event: string; timestamp: number; custom_data: CustomData[]; } export interface CustomData{ value: string;…
-
1
votes2
answers1557
viewsA: Problem when integrating Jquery, bootstrap and Popper.Js scripts at angular 6
The recommended and follow the official documentation: https://github.com/angular/angular-cli/wiki/stories-include-bootstrap Another suggestion would be to use libraries as ng-bootstrap.…
-
0
votes1
answer204
viewsA: Menu and routes and subroutes
You can have a path ** at the end of your routes that uses a not found Component or something. { path: '**', component: PageNotFoundComponent }
angularanswered Eduardo Vargas 3,413 -
2
votes1
answer732
viewsA: Send angular form
Opa arranged here for you see in my stackblits, https://stackblitz.com/edit/angular-yeqm1j?file=src%2Fapp%2Fapp.component.ts First you do not need value and max-length. You can do the validation…
angularanswered Eduardo Vargas 3,413 -
1
votes1
answer858
viewsA: How to use Ngmodule modules and decorator?
Modules are the main form of organization and architecture that angular provides. So like anything related to architecture depends mainly of each project. But according to the Official documentation…
-
0
votes1
answer93
viewsA: Angular: Connect multiple fields to a reactive form
For each select or input you have you have to add a corresponding row when creating your form. And through the formControlName field you map each select/input for your respective control. this.form…
-
1
votes2
answers535
viewsA: Identify numbers and letters typed in input fields with typescript
Try something like: <input [pattern]="passwordRegex" type="password" [(ngModel)]='pp'> no ts: passwordRegex="seuRegex"
-
0
votes2
answers1717
viewsA: Ngmodel with angular checkbox
Try using the array map function: this.selectedIds.map(id=>{ const obj={}; obj[id-1]=true; return obj; })
angularanswered Eduardo Vargas 3,413 -
1
votes1
answer634
viewsA: Why does the app.component.css file not work in Angular?
The css app is specific to the Component app, the body is above it in the gift so it won’t work. To change the overall style you have to change the style.css file what you can try in app.css and…
-
-1
votes2
answers81
viewsA: Inaccessible attribute value
You are trying to access a property that has not been initialized and will only be set after an http request. To get around this the easiest way and use ngIF <ion-card *ngIf="criteria">…
-
1
votes1
answer674
viewsA: Primeng dropdown does not load
Looks like you forgot the optionLabel: <p-dropdown [options]="menus" name="restaurantId" optionLabel="name" placeholder="Selecione" [(ngModel)]="menus" ></p-dropdown>…
angularanswered Eduardo Vargas 3,413 -
0
votes1
answer42
viewsA: Perform tests based on component Lifecycle
You can call your own Component function: it('should initiate', () => { component.ngOnInit(); expect(compiled.textContent).toEqual('Init'); });
-
0
votes2
answers39
viewsA: Insert a value into a variable in the form
You can use the es6 Host spread salvar() { this.service.postSubgroup({...this.formulario.value, id: this.idGroup}); }
-
0
votes3
answers4910
viewsA: Consuming an API with Angular
The problem is that you are not receiving an array but an object that contains an array. export interface GetAlunosResponse { alunos: Estudante[]; } export interface Estudante: { aluno:Aluno;…
-
1
votes1
answer464
viewsA: When loading list, mat-select should be already filled
You have to use mat-select function compareWIth <mat-select multiple formControlName="typePaymentDetailsModel" placeholder="Tipo de Pagamento" name="payment" [compareWith]="comapreValues">…
-
0
votes1
answer90
viewsA: ngFor with checkbox is selecting all values
Remove checked at the end of your html input
-
0
votes1
answer307
viewsA: Send headers in angular http request
Try it this way: trocaToken(token):Observable<any>{ const httpOptions = { headers: new HttpHeaders({ Content-Type': 'application/x-www-form-urlencoded', 'token': token }) }; return…
-
0
votes1
answer41
viewsA: Close sidenav when width is less than 700
To get the width of the screen does so: innerWidth: number; ngOnInit() { this.innerWidth = window.innerWidth; if(this.innerWidth < 700){ this.sidenav.close(); } } To keep updated on resize…
-
1
votes2
answers78
viewsA: How to display and hide Toogle inside ngfor correctly?
The best way to do that would be: First map to list for each element to have a status as false array = array.map(obj = > { obj.status=false; return obj; }) Then your toggle function can be like…
-
1
votes1
answer352
viewsA: Error in mat-select when trying to choose an item
I tidied up your code and added comments on the changes I made or you need to make. import { Component, OnInit } from '@angular/core'; import { FormBuilder, FormGroup } from '@angular/forms';…
-
3
votes1
answer693
viewsA: I can’t load data into an angular mat-select 6
Don’t forget to import Matselectmodule into the module that you declare your component import {MatSelectModule} from '@angular/material/select'; imports: [..., MatSelectModule]…
-
0
votes3
answers831
viewsA: SHA-1 with Typescript
Industry standard and Apis send the password to the backend in a secure way with https as normal text and do the encryption in the backend.
-
1
votes2
answers71
viewsA: How to write to mongodb via API
It seems you forgot to import the reactive FormsModule where you declare your component. import { ReactiveFormsModule } from '@angular/forms'; @NgModule({ imports: [ ReactiveFormsModule ],…
-
0
votes3
answers139
viewsA: Angular2 Tynymce Text editor
You can use the default Blur or Focus html event <input (blur)="onBlur()" (focus)="onFocus()">
-
0
votes1
answer88
viewsA: Change label class to active after angular http request
You could use the ngClass it has the following syntax ngClass="{classe: condicao}" <div class="md-form form-lg"> <input [ngClass]="{active: cliente.whatsapp}" type="text" id="form2"…
-
0
votes2
answers146
viewsA: How to catch the return of a service within a @Component with angular 6
tries to initialize values as an empty array. public values: any[] = []; Tbm if datasource has to point to the right property <table mat-table [dataSource] = "values" class="mat-elevation-z8">…
-
1
votes2
answers295
viewsA: How to create an array with results obtained through an observable<any[]> TYPESCRIPT
Do it like this: In service: queryProd(as:string){ return this.db.list(`/Produto/${as}`); } getItems(ids: string[]): Observable<Item> { return from(ids).pipe( mergeMap(id =>…
-
1
votes4
answers7972
viewsA: How can I make a copy of an array without reference?
Using ES6: var a = ["teste", "teste1"]; var b =[... a]; a[0] = "teste3"; b[0] = "teste4"; console.log(a) //mostrar teste3 console.log(b) //mostrar teste4
-
2
votes1
answer54
viewsA: Variable copy in angular 2(typescript)
For arrays using es6 vc can do so: var a = ["teste", "teste1"]; var b =[...a]; a[0] = "teste3"; b[0] = "teste4"; console.log(a) //mostrar teste3 console.log(b) //mostrar teste4…
angularanswered Eduardo Vargas 3,413 -
1
votes1
answer89
viewsA: Error while trying to load a mat-table with angular 6
Through the documentation of the angular material each import has its own path. This is to try to be as modular as possible. For example: import {MatInputModule} from '@angular/material/input';…
-
1
votes2
answers428
viewsA: Load log by id in Angular
Try it this way: Service import { map } from 'rxjs/operators'; import { HttpClient } from '@angular/common/http'; constructor(private http: HttpClient) { } restaurantById(id: string):…
angularanswered Eduardo Vargas 3,413 -
3
votes3
answers476
viewsA: Observable returning Undefined
The problem is that Voce is using this twice. this.Restaurants != Restaurants .subscribe(restaurants => { this.restaurants =restaurants console.log('o valor é ' , this.restaurants); })…
angularanswered Eduardo Vargas 3,413 -
1
votes1
answer108
viewsA: 'app-welcome' is not a known element Angular 2+
To use the component of a module within another module you have to add it to the Xports. declarations: [MeuComponent], exports: [MeuComponent]
-
1
votes1
answer52
viewsA: Name does not get fixed in variable
Try to copy the string value instead of passing the reference this.nomeProd = Object.assign('', formGroup.controls['nomeProduto'].value);
angularanswered Eduardo Vargas 3,413 -
1
votes1
answer733
viewsA: Responsive design in 2+ angular
You can use media query in your css normally. If you want to use ngIf to dynamically remove gift elements take a look at my answer here How to work with Angular ngIF with screen resolution? Catching…
-
1
votes1
answer924
viewsA: Angular or Angularjs
The main differences are: Angular cli: Although in Angularjs you can generate the project with tools like Yeoman angular 2 has angular-cli which makes it easy not only to have a standard way of…
-
0
votes1
answer208
viewsA: Bad Request 400: When accessing API with Ionic 3
Try it this way: const link = 'http://localhost:1337/user/login'; const options = { params: new HttpParams() .set('email', this.usuario.email) .set('senha', this.usuario.senha) };…
-
1
votes1
answer777
viewsA: Pass value to another angular page
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…
-
1
votes1
answer838
viewsA: How do I publish an Angular CLI project to my server?
First check that when you give the build your href is according to what you expect. If it is direct from the site for example site.com.br ## não precisa do href if you want to do something like…
-
2
votes1
answer31
viewsA: Click function with a model variable
At the angle inside the method does not need the brackets. <button class="btn btn-info" (click)="PegarValores(pesquisas.Codigo)"> <i class="glyphicon glyphicon-ok"…
-
0
votes1
answer1350
viewsA: Angular 6 Special characters (Accent and cedilla)
add the tag <meta charset="utf-8"> Inside the head of your index.html file
-
0
votes3
answers324
viewsA: Error with map operator
If you use the Httpclient library instead of http you don’t need to map to json. Another thing tbm, vc can use the Generics and pass its Interface that the angular automatically infers the type of…
angularanswered Eduardo Vargas 3,413 -
1
votes1
answer681
viewsA: Script file on an angular Component
I made this generic method to add a js dynamically. See that method and asynchronous. So just use the script in callback. constructor(private renderer: Renderer2) { } addJsToElement(src: string):…