首先是在js里面我们可以用clone来点击添加一些东西比如列表或者其他的div之类的,但是在angular里面怎么实现点击添加呢?
类似这种:
这样就尴尬了,最少我这样的菜鸟是不知道怎么去写的,网上好像也没有!
后来一个老司机,哦不,大牛告诉我用ng-repeat可以实现
大概的代码是酱紫的:
h5:
<!--其他发明人-->
<div>
<!--添加发明人-->
<div class="ova mb30 ml15p">
<span class="color_standard curp" ng-click="replyObj.add_inventor()">
添加发明人 >
</span>
</div>
<div class="por" ng-repeat="inventor in replyObj.applicant.inventor.other">
<!--<div class="applicantDivider"></div>-->
<!--公布姓名-->
<div class="info_item">
<div class="infoItem_name"><span class="infoItem_needed">*</span>公布姓名:</div>
<div class="infoItem_content">
<div class="dib mr30">
<input ng-model="inventor.publish" > </div>
js:
大概就是这样,然鹅,它会报错,vm.applicant.inventor.push是undefind(最开始的h5代码里面我没有添加other,至于为什么就不告诉你们了)!
vm.applicant={};
vm.applicant.inventor={
other:[]
};
就这么简单!兴奋至于特此记录本次的脑残事件!