Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 无法分配对象';的只读属性#&书信电报;对象>'; urldata:any={}; 构造函数(私有搜索服务:搜索服务,私有路由:路由器,私有激活路由:激活路由, 私有存储:存储,私有引用:ChangeDetectorRef,公共主题服务:主题服务){ this.activatedroute.queryParams.subscribe(查询=>{ if(查询['fq']){ if(查询['fq'].包括('png')){ this.resultDisplay='images'; this.urldata.fq='url\u file\u ext\s:(png+或+jpeg+或+jpg+或+gif)'; }else if(查询['fq'].包括('avi')){ this.resultDisplay='videos'; }否则{ this.resultDisplay='all'; } }否则{ this.resultDisplay='all'; } if(查询['resultDisplay']){ this.resultDisplay=query['resultDisplay']; this.urldata.resultDisplay=this.resultDisplay; } this.urldata.start=query['start']| | 0; this.urldata.query=query['query']; this.urldata.sort=query['sort']; this.urldata.rows=Number(查询['rows'])| | 10; this.message=''; this.store.dispatch(新的queryactions.QueryAction(query['query']); this.store.dispatch(新的queryactions.QueryServerAction(this.urldata));_Angular_Observable_Ngrx_Angular2 Observables - Fatal编程技术网

Angular 无法分配对象';的只读属性#&书信电报;对象>'; urldata:any={}; 构造函数(私有搜索服务:搜索服务,私有路由:路由器,私有激活路由:激活路由, 私有存储:存储,私有引用:ChangeDetectorRef,公共主题服务:主题服务){ this.activatedroute.queryParams.subscribe(查询=>{ if(查询['fq']){ if(查询['fq'].包括('png')){ this.resultDisplay='images'; this.urldata.fq='url\u file\u ext\s:(png+或+jpeg+或+jpg+或+gif)'; }else if(查询['fq'].包括('avi')){ this.resultDisplay='videos'; }否则{ this.resultDisplay='all'; } }否则{ this.resultDisplay='all'; } if(查询['resultDisplay']){ this.resultDisplay=query['resultDisplay']; this.urldata.resultDisplay=this.resultDisplay; } this.urldata.start=query['start']| | 0; this.urldata.query=query['query']; this.urldata.sort=query['sort']; this.urldata.rows=Number(查询['rows'])| | 10; this.message=''; this.store.dispatch(新的queryactions.QueryAction(query['query']); this.store.dispatch(新的queryactions.QueryServerAction(this.urldata));

Angular 无法分配对象';的只读属性#&书信电报;对象>'; urldata:any={}; 构造函数(私有搜索服务:搜索服务,私有路由:路由器,私有激活路由:激活路由, 私有存储:存储,私有引用:ChangeDetectorRef,公共主题服务:主题服务){ this.activatedroute.queryParams.subscribe(查询=>{ if(查询['fq']){ if(查询['fq'].包括('png')){ this.resultDisplay='images'; this.urldata.fq='url\u file\u ext\s:(png+或+jpeg+或+jpg+或+gif)'; }else if(查询['fq'].包括('avi')){ this.resultDisplay='videos'; }否则{ this.resultDisplay='all'; } }否则{ this.resultDisplay='all'; } if(查询['resultDisplay']){ this.resultDisplay=query['resultDisplay']; this.urldata.resultDisplay=this.resultDisplay; } this.urldata.start=query['start']| | 0; this.urldata.query=query['query']; this.urldata.sort=query['sort']; this.urldata.rows=Number(查询['rows'])| | 10; this.message=''; this.store.dispatch(新的queryactions.QueryAction(query['query']); this.store.dispatch(新的queryactions.QueryServerAction(this.urldata));,angular,observable,ngrx,angular2-observables,Angular,Observable,Ngrx,Angular2 Observables,上面的代码给了我: 未捕获(承诺中):TypeError:无法分配给对象“#”的只读属性“start” 什么会导致这个错误 我已经在我的组件中定义了urldata:any={}。Odd…您介意给urldata对象start、query、sort和行属性,并将它们默认为null? urldata:any = {}; constructor(private searchservice: SearchService, private route: Router, private activat

上面的代码给了我:

未捕获(承诺中):TypeError:无法分配给对象“#”的只读属性“start”

什么会导致这个错误


我已经在我的组件中定义了
urldata:any={}

Odd…您介意给
urldata
对象
start
query
sort
属性,并将它们默认为
null
urldata:any = {};

   constructor(private searchservice: SearchService, private route: Router, private activatedroute: ActivatedRoute,
              private store: Store<fromRoot.State>, private ref: ChangeDetectorRef, public themeService: ThemeService) {
this.activatedroute.queryParams.subscribe(query => {

  if (query['fq']) {

    if (query['fq'].includes('png')) {
      this.resultDisplay = 'images';
      this.urldata.fq = 'url_file_ext_s:(png+OR+jpeg+OR+jpg+OR+gif)';
    } else if (query['fq'].includes('avi')) {
      this.resultDisplay = 'videos';
    } else {
      this.resultDisplay = 'all';
    }
  } else {
    this.resultDisplay = 'all';
  }
  if (query['resultDisplay']) {
    this.resultDisplay = query['resultDisplay'];
    this.urldata.resultDisplay = this.resultDisplay;
  }
  this.urldata.start = query['start'] || 0 ;
  this.urldata.query = query['query'];
  this.urldata.sort = query['sort'];
  this.urldata.rows = Number(query['rows']) || 10;

  this.message = '';

  this.store.dispatch(new queryactions.QueryAction(query['query']));
  this.store.dispatch(new queryactions.QueryServerAction(this.urldata));