0
我有这样的代码在我的.aspx和是一个UpdatePanel内有触发事件的onclickC#为什么当我用updatepanel回发时,组件Angularjs消失了?
<div id="componentdt" ng-app="myApp" ng-controller="MyCtrl" class="container" style="width: 100%">
<div rm-datepicker ng-model="oDate1" rm-config="rmConfig1"></div>
<input type="hidden" id="selectedPartnerId" runat="server" ng-value="oDate1 | date: 'dd-MM-yyyy'" />
</div>
,这是我的脚本,我在我的.aspx。
<script>
var app = angular.module("myApp", ["rmDatepicker"]);
/* Datepicker global configuration */
app.config(["rmDatepickerConfig", function (rmDatepickerConfig) {
rmDatepickerConfig.mondayStart = true;
rmDatepickerConfig.initState = "month";
}]);
</script>
<script>
$(document).ready(function() {
var app = angular.module("myApp");
var MyCtrl = function ($scope) {
var currentDate = new Date();
var date = currentDate.setDate(currentDate.getDate() + 1);
/* Datepicker local configuration */
$scope.rmConfig1 = {
mondayStart: false,
initState: "month", /* decade || year || month */
maxState: null,
minState: "month",
decadeSize: 12,
monthSize: 42, /* "auto" || fixed nr. (35 or 42) */
min: new Date(date),
max: new Date('2023-11-21'),
format: "yyyy-MM-dd" /* https://docs.angularjs.org/api/ng/filter/date */
};
$scope.rmConfig2 = { format: "d MMM yyyy" };
$scope.oDate1 = new Date(date);
$scope.oDate2 = null;
$scope.clearInput = function() {
$scope.oDate2 = null;
}
};
app.controller("MyCtrl", ['$scope', MyCtrl]);
}());
// Init waves (OPTIONAL) :)
// window.onload = Waves.init();
</script>
那么,当我做回发时,这个组件消失了,我不知道为什么。 我从AngularJS和ASP.NET webforms开始