AngularJS+RequireJs实现动态加载JS和页面的方案研究【下】
about.js:
[html] view plain copy 在CODE上查看代码片派生到我的代码片
define(['app'], function(app)
{
app.controller('AboutViewController',
['$scope',function($scope) {
document.getElementById("test").onclick = function(){
swal($scope.title);
}
$scope.title = "About About About About";
}
]);
});
其对应的页面内容about-view.js:
[html] view plain copy 在CODE上查看代码片派生到我的代码片
<div ng-controller="AboutViewController">
<button ui-sref="home">Home</button>
<h1>{{ title }}</h1>
<form name = "registerForm" method="post" class="form-horizontal" novalidate >
<p class="bg-warning" style = "margin-left:50px;margin-right:50px;"><i class="glyphicon glyphicon-info-sign"></i><span > <b>温馨提示:带<span style="color:red"> *</span>为必填项</b></span><span ng-show = "contractInfo.status == 'INVALID'||contractInfo.status == 'END'" ><b> </b></span></p>
<p style = "margin-left:50px;margin-right:50px;" ng-show = "contractInfo.status == 'INVALID'||contractInfo.status == 'END'"><b>已失效或终止的合同不能再修改内容!</b></p>
<p style = "margin-left:50px;margin-right:50px;" ng-show = "contractInfo.status == 'EFFECTIVE'"><b>已生效的合同只能修改部分内容!</b></p>
<div>
<div class="form-group" >
<label class="control-label col-md-2 " for = "merchantId">商户<span style="color:red"> *</span></label>
<div class="col-md-3" show-errors>
<select class="form-control" required >
<option value="">-- 请选择 --</option>
</select>
<div class="help-block" ng-messages="registerForm.merchantId.$error" ng-if="registerForm.merchantId.$touched">
<span ng-message="required" >商户不能为空</span>
</div>
</div>
<label class="control-label col-md-2" for="contractNo">合同编号</label>
<div class="col-md-3" >
<input type="text" class="form-control" >
</div>
</div>
<div class="form-group" >
<label class="control-label col-md-2" for="signDate">合同签订日期<span style="color:red"> *</span></label>
<div class="col-md-3" show-errors>
<div class="input-group" readonly= "readonly">
<input type="text" class="form-control" date-format uib-datepicker-popup required>
<span class="input-group-addon" ng-click = "signDateOpened = true"><i class="glyphicon glyphicon-calendar"></i></span>
</div>
<div class="help-block" ng-messages="registerForm.signDate.$error" ng-if="registerForm.signDate.$touched">
<span ng-message="required" >合同签订日期不能为空</span>
</div>
</div>
<label class="control-label col-md-2" for="signPerson">合同签署人<span style="color:red"> *</span></label>
<div class="col-md-3" show-errors>
<input type="text" class="form-control" required >
<div class="help-block" ng-messages="registerForm.signPerson.$error" ng-if="registerForm.signPerson.$touched" >
<span ng-message="required" >合同签署人不能为空</span>
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-2" for="effectDate">合同生效日期<span style="color:red"> *</span></label>
<div class="col-md-3" show-errors>
<div class="input-group" >
<input type="text" class="form-control" date-format uib-datepicker-www.baiyuewang.netpopup required>
<span class="input-group-addon" ng-click = "effectDateOpened = true"><i class="glyphicon glyphicon-calendar"></i></span>
</div>
<div class="help-block" ng-messages="registerForm.effectDate.$error" ng-if="registerForm.effectDate.$touched">
<span ng-message="required" >合同生效日期不能为空</span>
</div>
</div>
<label class="control-label col-md-2" for="expiryDate">合同失效日期<span style="color:red"> *</span></label>
<div class="col-md-3" show-errors>
<div class="input-group" >
<input type="text" class="form-control" date-format uib-datepicker-popup required>
<span class="input-group-addon" ng-click = "expiryDateOpened = true"><i class="glyphicon glyphicon-calendar"></i></span>
</div>
<div class="help-block" ng-messages="registerForm.expiryDate.$error" ng-if="registerForm.expiryDate.$touched">
<span ng-message="required" >合同失效日期不能为空</span>
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-2" for="autoResignFlag">到期自动续签<span style="color:red"> *</span></label>
<div class="col-md-3" show-errors>
<select class="form-control" required >
</select>
<div class="help-block" ng-messages="registerForm.autoResignFlag.$error" ng-if="registerForm.autoResignFlag.$touched">
<span ng-message="required" >到期自动续签不能为空</span>
</div>
</div>
<label class="control-label col-md-2" for="autoResignYears">自动续签期限</label>
<div class="col-md-3" >
<input type="text" class="form-control" >
<div class="help-block" ng-messages="registerForm.autoResignYears.$error" ng-if="registerForm.autoResignYears.$touched">
<span ng-message="required" >自动续签期限不能为空</span>
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-2" for="fundTyps">涉及款项列表</label>
<div class="col-md-3" >
<input type="text" class="form-control" >
</div>
<label class="control-label col-md-2" for="specialInstallReq">有特殊分期要求<span style="color:red"> *</span></label>
<div class="col-md-3" show-errors>
<select class="form-control" required>
</select>
<div class="help-block" ng-messages="registerForm.specialInstallReq.$error" ng-if="registerForm.specialInstallReq.$touched">
<span ng-message="required" >特殊分期要求不能为空</span>
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-md-2" for="remark">备注</label>
<div class="col-md-8">
<textarea class="form-control" cols="4" ></textarea>
</div>
</div>
<div class="form-group" style = "text-align:center">
<button class="btn btn-primary" type="button" ng-click="okContractEdit()" ng-show = "contractEditable" >保存修改</button>
<button class="btn btn-warning" type="button" ng-click="cancelContractEdit()"ng-show = "contractEditable" >取消修改</button>
</div>
</div>
<div>
</form>
</div>