.html

<div>
{{instance.description}}
<span class="glyphicon glyphicon-pencil btn-link" ng-click="editInstance(instance)" ></span>
</div> //以下是做出弹出框
<script type="text/ng-template" id="edit-instance-desc.html">
<div class="modal-header">
<h3>Please Edit Instance's Description</h3>
</div> <div class="modal-body">
<input class="text form-control" value="{$ instance.description $}" onFocus="if(value==defaultValue){value='';this.style.color='#000'}" onBlur="if(!value){value=defaultValue; this.style.color='#999'}" style="color:#999" ng-model="description" id="description" />
</div> <div class="modal-footer">
<button class="btn btn-default" ng-click="cancel()">Cancel</button>
<button class="btn btn-primary" ng-click="confirm(description)">Submit</button>
</div>
</script>

  

.js

// edit instance's description
$scope.editInstance = function(instance){
var modalInstance = $modal.open({
templateUrl: 'edit-instance-desc.html',
controller: EditInstanceDescController,
resolve: {
instance: function(){
return instance;
}
}
});
modalInstance.result.then(function(data) {
if (data['error']){
growl.error(data['error']);
}else {
$state.transitionTo($state.current, $stateParams, {
reload: true,
inherit: false,
notify: true
});
}
}, function(){
});
};
var EditInstanceDescController = function($scope, $modalInstance, growl, CommonHttpService, instance){
$scope.instance = instance;
$scope.description = instance.description;
$scope.cancel = function(){
$modalInstance.dismiss();
};
$scope.confirm = function(description){
api_url = '/api/user/instance/' + instance.id + '/';
post_data = {
"editInstance":description
};
CommonHttpService.put(api_url, post_data).then(function(data){
instance.description = description;
$modalInstance.close(data);
}, function(){
$modalInstance.close(data);
});
}
};

  

最新文章

  1. 高性能 TCP &amp; UDP 通信框架 HP-Socket v3.5.1
  2. checkbox全选-取消-再全选没有显示问题
  3. Java synchronized同步 各方式略解
  4. [转]使用Sencha Ext JS 6打造通用应用程序
  5. 纯CSS实现tooltip提示框,CSS箭头及形状
  6. php实现的IMEI限制的短信验证码发送类
  7. HM中再增加一路自己的entropy coder
  8. 安装CouchbaseClient的过程中提示 Error 1935.An error occurred during the installation of assembly;Error:-1603 fatal error during installation
  9. 在centos中php 在连接mysql的时候,出现Can&#39;t connect to MySQL server on &#39;XXX&#39; (13)
  10. C/S通信模型和相关技术要点
  11. BZOJ 3505: [Cqoi2014]数三角形 [组合计数]
  12. 【NOI2001】炮兵阵地(状态压缩,动态规划)
  13. The summary of Interview
  14. HTML DOM - 导航
  15. cocos2dx 开启控制台
  16. Beta(0/7)
  17. Ajax 执行顺序
  18. (转)一位资深程序员大牛给予Java初学者的学习路线建议
  19. WIN10在loadrunner安装或path4插件安装时遇到的管理员阻止程序运行---解决方案(可用)
  20. We FALL ASleep At Night, We Do REST Right

热门文章

  1. exception throw in progress runner thread_VS2015中SVN源代码无说明提交异常
  2. 【Java每日一题】20161107
  3. eclipse的快捷操作(转)
  4. 关于java jni编译javac javah的问题
  5. SDL制作拼图游戏
  6. 【转】PHP计划任务:如何使用Linux的Crontab执行PHP脚本
  7. Send push notification on Apple (APNS) on c#.net
  8. 20款响应式的 HTML5 网页模板【免费下载】
  9. JavaScript基础系列(变量与类型)
  10. 【转】ES6 手册