<!DOCTYPE html>
<html ng-app="app">
<head>
<title>demo</title>
<meta charset="utf-8"/>
<script src="http://cdn.bootcss.com/jquery/3.0.0-alpha1/jquery.min.js"></script>
<script id="others_angular_103" type="text/javascript" class="library" src="http://sandbox.runjs.cn/js/sandbox/other/angular.min.js"></script>
<style>
.contani{
width: 100%;
height: 300px;
border: 1px solid red;
}
</style>
</head>
<body ng-controller="myCtrl">
<script>
var app = angular.module('app',[]);
app.controller('myCtrl', ['$scope','$compile',function(scope,$compile){
scope.valchange = function(){
console.log('value change')
}
scope.edit = function(){
//假设这是ajax返回的数据
scope.username = 'wangmeijian';
scope.password = '000000';
$(".contani").html(myTmpl.innerHTML);
}
}])
</script>
<button ng-click="edit()">修改资料</button>
<div class="contani"></div>
<script type="text/html" id="myTmpl">
<form>
用户名:<input type="text" ng-model="username" />
密码:<input type="text" ng-model="password" />
</form>
</script>
</body>
</html>
<!DOCTYPE html>
<html ng-app="app">
<head>
<title>demo</title>
<meta charset="utf-8"/>
<script src="http://cdn.bootcss.com/jquery/3.0.0-alpha1/jquery.min.js"></script>
<script id="others_angular_103" type="text/javascript" class="library" src="http://sandbox.runjs.cn/js/sandbox/other/angular.min.js"></script>
<style>
.contani{
width: 100%;
height: 300px;
border: 1px solid red;
}
</style>
</head>
<body ng-controller="myCtrl">
<script>
var app = angular.module('app',[]);
app.controller('myCtrl', ['$scope','$compile',function(scope,$compile){
scope.valchange = function(){
console.log('value change')
}
scope.edit = function(){
//假设这是ajax返回的数据
scope.username = 'wangmeijian';
scope.password = '000000';
//$(".contani").html(myTmpl.innerHTML);
$(".contani").append( $compile(myTmpl.innerHTML)(scope) )
}
}])
</script>
<button ng-click="edit()">修改资料</button>
<div class="contani"></div>
<script type="text/html" id="myTmpl">
<form>
用户名:<input type="text" ng-model="username" ng-change="valchange()" />
密码:<input type="text" ng-model="password" ng-change="valchange()" />
</form>
</script>
</body>
</html>
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有