angular2-services

Angular 2 TypeScript how to find element in Array

大城市里の小女人 提交于 2020-07-31 06:14:39
问题 I have a Component and a Service: Component: export class WebUserProfileViewComponent { persons: Person []; personId: number; constructor( params: RouteParams, private personService: PersonService) { this.personId = params.get('id'); this.persons = this. personService.getPersons(); console.log(this.personId); } } Service: @Injectable() export class PersonService { getPersons(){ var persons: Person[] = [ {id: 1, firstName:'Hans', lastName:'Mustermann', email: 'mustermann@test.com', company:

Angular 2 TypeScript how to find element in Array

风流意气都作罢 提交于 2020-07-31 06:14:34
问题 I have a Component and a Service: Component: export class WebUserProfileViewComponent { persons: Person []; personId: number; constructor( params: RouteParams, private personService: PersonService) { this.personId = params.get('id'); this.persons = this. personService.getPersons(); console.log(this.personId); } } Service: @Injectable() export class PersonService { getPersons(){ var persons: Person[] = [ {id: 1, firstName:'Hans', lastName:'Mustermann', email: 'mustermann@test.com', company:

Cannot pass data with service in angular2

十年热恋 提交于 2020-06-28 04:16:06
问题 PS: When I talk to my colleague, they told me to get Role's right with once request, if it is not authenticated then reject, else return the data to frond-end. But, I got stuck in use Angular2's Guard. Apps do: Access my routes, and Guard prevent it, the Guard send a request to server to check its auth. Request the server , when server return statue:true and data:[somedatas] then set data with module's dataService , and resolve true for canActivate. Init the target component, in constructor ,

Cannot read property 'setRowData' of undefined

那年仲夏 提交于 2020-03-16 07:41:12
问题 I am trying to get new data on my ag grid. I tried using this.gridOptions.api.setRowData(rowdata); but it throws this error Cannot read property 'setRowData' of undefined I have kept this method in the onGridReady method at the onInit method. Not sure if that helps, but I am using cellRenderer also. Does this method work for anyone else? Is there anything specific to call this method? 回答1: The gridReady event has the api as a parameter. Try event.api.setRowData(), or set the row data using

SOAP - WSDL request angular2/4 framework

十年热恋 提交于 2020-02-27 05:58:58
问题 Still I am learning angular2. I am trying to learn how to send SOAP request to a web service, with a WSDL. I was searching for some examples and found one. I created a button and wanted to call that soap function to send request to server on a click. The project is successfully built but the function doesn't work. app.component.ts import { Component } from '@angular/core'; import { Http, Response, RequestOptions, Headers} from '@angular/http'; import 'rxjs/add/operator/map'; declare var