[Solved] How to set focus on an input that works on IOS supporting devices?

You can use the following: @Component({ selector: ‘my-app’, template: ` <div *ngFor=”let item of [1,2,3,4]; let i = index”> <button type=”button” (click)=”display(i)”>Click to show and set focus</button> <input #theInput *ngIf=”show === i” type=”text” > </div> `, }) export class App { show = -1; @ViewChild(‘theInput’) private theInput; constructor() { } display(i) { this.show = i; … Read more

[Solved] how to understand angular ng-class and dynamic class [closed]

In the base, it works like: You create some class (css/scss) You bind that class dynamicly to your html element based on some condition. Example isBlack = true; div.my-dynamic-class { background-color: #000000; } <div [ngClass]=”{‘my-dynamic-class’: isBlack}”></div> where isBlack would be the boolean based on that class will be applied. Here is the complete documentation: LINK … Read more

[Solved] Any reference for Angular material 2 responsive?

There are plenty of frameworks that you can use. You can use Bootstrap, Material and Zurb Foundation which are very stable: For Material: npm install –save @angular/material @angular/cdk Also you can get help from here: https://material.angular.io/guide/getting-started For Bootstrap 3: npm install [email protected] –save For Bootstrap 4: npm install bootstrap –save If you added the Bootstrap … Read more

[Solved] angular 6 wait post response

Using async/await is perfect for your situation. It will help you to make your code more readable and make abstraction of the async part thanks to the await keyword aync post(){ const res1 = await this._service1.save(this.data1).toPromise(); const res2 = await this._service2.save(res1).toPromise(); console.log(‘here is my data 2 ‘ + res2); return ‘what you want, can be … Read more

[Solved] Multiple parameters as http request Data in angular 4

Just send it as array of object in key value pair like this CreateMethod(input:HTMLInputElement){ let firstName = {title:input.value} input.value=””; let arrayYouNeedToSend = [{title:input.value}]; this.http.post(this.url,JSON.stringify(arrayYouNeedToSend)) .subscribe(response=>{ //firstName.id=response.json().id; this.postvalue.splice(0,0,firstName); console.log(response.json()); }) 1 solved Multiple parameters as http request Data in angular 4

[Solved] Interview Advice [closed]

There are a lot of possible answers, what I think he expected was that you need to make sure that a component is not re-rendered X times more than it should be. For instance, if you setState without checking for redundancy, your component/App will render a lot more than it should if you did the … Read more

[Solved] When using “ng generate library” what is an Angular “Library”?

An “angular library” in this context refers to self-contained Angular project that stands by itself in the projects/ directory, An Angular Library is summarized as, Many applications need to solve the same general problems, such as presenting a unified user interface, presenting data, and allowing data entry. Developers can create general solutions for particular domains … Read more

[Solved] How to filter an array with multiple parameters

You don’t have pageTypeId property in the object. Because of that, i changed this property to id in the statement, and if you want filter value 1 or 2, i used || characters. Maybe you will edit your code like this, it will work. let tmpArray = [{“id”:”1″},{“id”:”2″},{“id”:”2″},{“id”:”3″},{“id”:”3″}]; this.nodes = tmpArray.filter(x => { return x.id.toString() … Read more