我有一个模态问题。成功更新后不会出现。
我有一个get请求返回import { Injectable } from '@angular/core';
import { Http, Response } from '@angular/http';
import { HttpParams } from '@angular/common/http';
import { Observable } from 'rxjs/Observable';
import { EnvironmentConfig } from '../../../common/shared/environment-config/environment-config.service';
@Injectable()
export class AccessRequestService {
private url: string;
constructor(
private http: Http,
private config: EnvironmentConfig
) {
this.url = this.config['api'];
}
getRequests(start: string, end: string): Observable<any> {
const params = new HttpParams();
params.set('start', start);
params.set('end', end);
return this.http.get(`${this.url}/objects`, { params })
.timeout(12000)
.map((res: Response) => res.json().objects);
}
}
页面的方法。
我尝试通过main.ssi.ts:10 Uncaught Error: Can't resolve all parameters for HttpParams: (?).
at syntaxError (http://ssi.local:4200/vendor.bundle.js:27181:34)
at CompileMetadataResolver.webpackJsonp.../../../compiler/@angular/compiler.es5.js.CompileMetadataResolver._getDependenciesMetadata (http://ssi.local:4200/vendor.bundle.js:41256:35)
at CompileMetadataResolver.webpackJsonp.../../../compiler/@angular/compiler.es5.js.CompileMetadataResolver._getTypeMetadata (http://ssi.local:4200/vendor.bundle.js:41124:26)
at CompileMetadataResolver.webpackJsonp.../../../compiler/@angular/compiler.es5.js.CompileMetadataResolver._getInjectableMetadata (http://ssi.local:4200/vendor.bundle.js:41110:21)
at CompileMetadataResolver.webpackJsonp.../../../compiler/@angular/compiler.es5.js.CompileMetadataResolver.getProviderMetadata (http://ssi.local:4200/vendor.bundle.js:41401:40)
at http://ssi.local:4200/vendor.bundle.js:41330:49
at Array.forEach (native)
at
将变量传递给此视图
但在这个html页面里,我总是有空值。
我的代码:
redirect:/users
有什么问题? 我只认为这是重定向的东西,因为在这个方法中我没有setViewName,但我必须这样做才能将变量传递给正确的模板。 谢谢你的帮助!