我想使用Angular2将数据显示在引导模式中。我已经使用“*ngfor”以模式为单位。但是使用*ngfor,模态不按照其行为显示数据(单击右箭头时,数据应更改,并且第一个数据默认为默认值)。但是,当我将活动类应用于“项目”时,它显示完整的数据,但以垂直格式显示。我希望它应该显示一个图像及其细节。这是我的app.component.htmlDetailsImageName{{modalData.Name}}和我的输出来自上述代码:看答案首先,您需要组织申请,将您的申请分为成分.例如,创建一个组件表示您的应用程序中提到*ngfor指令的HTML模板组件打字稿文件@Component({sel
当一个值传递到NGFOR循环中时,我的指示正在失去其样式。我有一个针对数据列列的指令,在其中设置了该列的名称。@Directive({selector:'[my-dt-column]'})exportclassMyDTColumn{@Output()onSort:EventEmitter=newEventEmitter();@HostBinding('class.sorted-asc')sortedAsc;@HostBinding('class.sorted-desc')sortedDesc;_sortOrder:string;publicsort(order?:string){this._s
我正在尝试重写用于渲染HTML选择元素的列表,以便其键与列表对象类型的主要标识符匹配。exportclassIndustry{constructor(publicindustryId?:number,publiccode?:number,publicdescription?:string){}}以我的形式:{{i.description}}当我分配从服务中获得的数组时,一切都很好,但是当我将其重写为关联阵列时,键匹配主标识符,它会使选择列表具有正确数量的选项,但没有值。privategetIndustries(){this.industryService.getIndustries().sub
我是Angular2的新手,我想通过forEach循环和某些条件。然后我想通过ngFor。对于Angular1(由Angular.Foreach循环)来说,这很容易。我该如何使用forEach我的组件中的循环以对数据进行更改?看答案在.ts文件中使用,for(varkeyindata.Result){console.log(data.Result[key]);}
在我的Angular4应用程序中,我需要使用少于Conditon的NGFOR。我的意思是我不想显示所有项目sampleArray,相反,我只想显示前10个项目,就像在普通Java脚本中一样i或者i等我想在NGFOR中使用的这种条件,是否有可能?{{a.firstname}}{{a.lastname}}看答案您只需使用切片即可。{{a.firstname}}{{a.lastname}}
在我的网站上,如果我的数组中有多个元素。我的模板看起来像这样。我想有一个按钮转到此数组的下一个元素,只显示一组数据,并使用该按钮来控制用户看到的数组的哪个元素。我当前的代码看起来像这样:DetailsDate:{{tag.date}}DCU:{{tag.dcu}}Location:{{tag.location}}我正在考虑使用某种索引或ng-container或使用NGIF或NGFOR进行一些工作。我不确定如何实施。所有的帮助将不胜感激!看答案在这种情况下,您将不需要NGFOR或NGIF。您想要的是一个变量,可以跟踪用户的索引,然后是更改索引的函数。DetailsDate:{{case?.in
我尝试从帖子列表中获取第一个资产。此列表来自WebAPI。import{Component,OnInit}from'@angular/core';import{BlogPostService}from'../services/blog-post.service';import{BlogPost}from'../modules/blog-post';@Component({selector:'af-home',templateUrl:'./home.component.html',styleUrls:['./home.component.scss']})exportclassHomeCompon
我试图弄清楚如何在Angular2应用程序中另一个阵列中的阵列中进行迭代。在我的组成部分中,我订阅了Angular的Ngoninit生命周期钩中的可观察到的。ngOnInit(){constrecords=this.filtersService.getByFilter(this.page,this.pagesize,{'services.workflow.status':'clientinformation'}).subscribe(resRecordsData=>{this.records=resRecordsData;console.log(this.records);},response
我只是尝试从typescript中的数组中删除对象,在Angular2.4.0中,让我展示代码,它是我的html文件:buttontype="submit"(click)="addAnotherLanguague()">AddnonnativelanguagueYearsstudiedRemove//hereyoucanseeuseofmethod还有component.ts(...)this.listOfLanguagues=newArray();}addAnotherLanguague(){this.listOfLanguagues.push(newLanguagueInforma
我只是尝试从typescript中的数组中删除对象,在Angular2.4.0中,让我展示代码,它是我的html文件:buttontype="submit"(click)="addAnotherLanguague()">AddnonnativelanguagueYearsstudiedRemove//hereyoucanseeuseofmethod还有component.ts(...)this.listOfLanguagues=newArray();}addAnotherLanguague(){this.listOfLanguagues.push(newLanguagueInforma