Hello All,
please could smb. help. I couldn't find it on uncle google.com :(
If I have in TodoService res.json in not standart format it retrun me null
,problem is that I have not standart input. How I should parse it .
what a http request return :
-----------------------------------
{
"uri":
"http://localhost:8081/artifactory/api/storage/ext-release-local/ticket"
"created": "2016-02-09T16:08:39.096+01:00"
"files": [16]
0: {
"uri": "/gradle"
"size": -1
"lastModified": "2016-02-09T15:27:26.189+01:00"
"folder": true
}-
1: {
"uri": "/gradle/gradle-wrapper.jar"
"size": 53637
"lastModified": "2016-02-09T15:27:10.000+01:00"
"folder": false
"sha1": "d5f2cff8bfce6bd848ee3dceb06393502f78ca7c"
}-
2: {
"uri": "/loop"
"size": -1
"lastModified": "2016-02-09T16:07:51.513+01:00"
"folder": true
}-
3: {
"uri": "/loop/monitor1"
"size": -1
"lastModified": "2016-02-09T16:07:51.513+01:00"
"folder": true
}-
-------------------------------------------------------------------------------------------
export class TodoListComponent {
constructor(
private todoService: TodoService
) {
this.todoService.fetch();
}
-------------------------------------------------------
@Injectable()
export class TodoService {
public todos: ITodo[] = [];
public storages: IStorage[] = [];
public data: string;
constructor(
private rest: RestService
) {}
fetch(): void {
alert('fetch');
this.rest.read('/storage/central-cache?list&deep=1','')
.map((res: Response) => res.json())
.subscribe((storages: IStorage[]) => this.storages = storages);
--------------------------------------------------------------------
@Injectable()
export class RestService {
constructor(
private http: Http,
private restOptions: RestOptions
) {}
private request(path: string, method: RequestMethod, body?: Object, search?:
Object): Observable<Response> {
alert('sem ale dojdu');
let options = new RequestOptions(this.restOptions.merge({
method: method,
url: this.restOptions.url + path,
body: JSON.stringify(body),
}));
alert('rest.Service.ts ');
return this.http.request(new Request(options));
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.