[Solved] how to call method of event in ngOnInit

You cannot do this reliably. After the component is created, event listener (@HostListener) are setup and ngOnInit is called by the framework. The listener will only react to the event you specify (in your case document:mousemove). If you wanted this value, the event would need to be fired between component creation (calling the constructor) and … Read more

[Solved] Get dropdown values using angular [closed]

You should use [(ngModel)]. For this, first you map your persons adding to properties “check” and “test”. When you get the data, use “map” to add the properties this.http.get(dataUrl).subscribe(response => { this.persons = response.data.map(x=>({…x,check:false,test:’test’})); this.dtTrigger.next(); }); Then you can change your .html, see how to disable you use [disabled]=”!person.check?true:null”and the [(ngModel)]=”person.check” and [(ngModel)]=”person.test” <tr *ngFor=”let … Read more

[Solved] Angular 5 -> Inputfield from Arrayentry

Okay, reviewing your HTML-template I’d suggest the following solution: extend your nagelpaletten-model by adding the field bestellmenge or just menge. e.g. export class nagelpaletten { constructor( bestellmenge: number, PKArtikelID: string, laenge: number, Gewicht: number, ME: number, Preis: number ) {} } Maybe your model is structured a little differently but mine is just supposed to … Read more

[Solved] How to group and add their value in array of objects in javascript?

Use Array reduce() var result = res.reduce((accu, obj) => { accu[obj.url] = (accu[obj.url] || 0) + obj.views; return accu; }, {} ); Output from node CLI: > var result = res.reduce((accu, obj) => { accu[obj.url] = (accu[obj.url] || 0) + obj.views; return accu; }, {}); undefined > result { ‘/page1’: 16, ‘/page2’: 5, ‘/page3’: 29 … Read more

[Solved] How to do a filtered select-option-like drop down in Android forms?

I suggest you a simple way cause you are new in android! add this function to your listView adapter: public void filterList(String searchText) { ArrayList<C_ChatListItem> temp = new ArrayList<>(); adapteritems = backupItems; // copy your Get response in backupItems for new searches in constructor // then in every new search retrieve adapterIems if(searchText != null … Read more

[Solved] Use RxJS’s group by at inside of Subscribe [closed]

how you do it: service: Dataa() { return this._http.get<any[]>(‘https://api.github.com/users’); // not a promise } component: _test; // not private ngOnInit() { this._test = this._apiService.Dataa().pipe( // set observable to variable switchMap(data => from(data).pipe( // array to stream groupBy((item: any) => item.type), // group by type mergeMap(group => zip(of(group.key), group.pipe(toArray()))), // convert each group back to array … Read more

[Solved] Why can’t I access a variable for data binding?

you must have a variable at class level like this export class SampleClass implements OnInit { data: any ; constructor() { } getData() { let request = new XMLHttpRequest(); request.open(‘GET’, ‘https://mywebsite.com/data.json’); request.onload = this.manageData.bind(this); request.send(); } resolveData(ev){ this.data = JSON.parse(ev.target.response); console.log(this.data); } } solved Why can’t I access a variable for data binding?

[Solved] Map the JSON key and update the value in another JSON using angular2

You can use Object.keys() to iterate over the keys of your first json object. Object.keys() returns a string array containing the key names. So we can call .forEach() on that result. In the foreach method we can use the key to access the child object in secondJsonObj. Object.keys(firstJsonObj).forEach(key => { if (secondJsonObj[key]) { secondJsonObj[key].value = … Read more