如何在角度js中将div添加到另一个div中点击添加更多字段按钮?

时间:2015-11-09 12:33:36

标签: html angularjs

实际上我需要在点击父div下方的按钮时添加两个下拉(选择)字段。我知道如何在jquery

中做
$(".add_more_projects").click(function(){
     $(".add_project").append(reg_prjctdetails);
}); 

var reg_prjctdetails = 
                '<div class="fms_reg_morefields">'+
                '<button class="smart_close" type="button" tooltip="close">×</button>'+
                '<div class="form-group col-md-6 col-sm-6" ng-class="{ has-error : userForm.curntpjct.$invalid && (userForm.curntpjct.$dirty || submitted)}">'+
                '<label>Current Project</label>'+
                '<span class="label label-danger pull-right" ng-show="userForm.curntpjct.$error.required      && (userForm.curntpjct.$dirty || submitted)">Required!</span>'+
                '<div class="input-group">'+
                '<div class="input-group-addon"><i class="glyphicon glyphicon-inbox"></i></div>'+
                '<select id="" tabindex="1" name="curntpjct" class="form-control" ng-model="user.curntpjct" ng-required="true">'+
                '<option value="">Current Project</option>'+
                '<option ng-repeat="cp in cpprocess" value="{{cp.value}}">'+
                '{{cp.value}}'+
                '</option>'+
                '</select>'+
                '</div>'+
                '</div>'+
                '<div class="form-group col-md-6 col-sm-6" ng-class="{ has-error : userForm.positio.$invalid && (userForm.positio.$dirty || submitted)}">'+
                '<label>Position</label>'+
                '<span class="label label-danger pull-right" ng-show="userForm.positio.$error.required      && (userForm.positio.$dirty || submitted)">Required!</span>'+
                '<div class="input-group">'+
                '<div class="input-group-addon"><i class="glyphicon glyphicon-inbox"></i></div>'+
                '<select id="" tabindex="1" name="positio" class="form-control" ng-model="user.positio" ng-required="true">'+
                '<option value="">Position</option>'+
                '<option ng-repeat="pos in posprocess" value="{{pos.value}}">'+
                '{{pos.value}}'+
                '</option>'+
                '</select>'+
                '</div>'+
                '</div>'+
                '<div class="clear"></div>'+
                '</div>';

所以,这是jquery中的程序。

但我不知道它在Angularjs中会是什么样子。任何人都可以帮助我吗?

0 个答案:

没有答案