https://www.cnblogs.com/wancy86/p/7834067.html
1. 原生事件中调用angular方法, 比如 input的onChange事件想调用angular里面定义的方法 - onChange="angular.element(this).scope().uploadPhoto(this)"
<div class="col-md-2">
<input onChange="angular.element(this).scope().uploadPhoto(this)" type="file" style="display: none;width: 0px;height: 0px;" ng-model="$parent.photos[$index]" name="newImg_{{$index}}" id="newImg_{{$index}}"/>
<button class="button button-energized" style="margin-bottom: 2px;" ng-click="selectPhoto($index)"><i class="ion-android-upload"></i> <span>上传图片</span></button>
<button ng-if="$index>0" class="button button-energized" ng-click="delImg($index)"><i class="ion-android-close"></i> <span>删除图片</span></button>
</div>
1. 动态表单, 注意用到的ng-init
和 this[size]
<div ng-app ng-init=‘size="X";X="165cm";XL="175cm"‘>
<p>X标准:<input ng-model="X"></p>
<p>XL标准:<input ng-model="XL"></p>
<p>选择你的体恤尺寸:
<select ng-model="size">
<option>X</option>
<option>XL</option>
</select></p>
<p>实际尺寸大小:
<input name="123" ng-model="this[size]"></p>
</div>
原文地址:https://www.cnblogs.com/gushixianqiancheng/p/11384464.html
时间: 2024-10-11 05:14:10