アプリケーションに次の html コードがあります (ng-app と ng-controller の値は前に定義されています)。
<div>
<label for="projectSearchDateFrom"><%= Res("Projects.Search.From")%></label>
<input id="projectSearchDateFrom" type="text" ng-model="startDate" ui-date="dateOptions"/>
<img ng-show="hasStartDate()" ng-click="clearStartDate()" src="/_Layouts/ClientPortal/Images/layout/TA/delete-small.png" alt="<%= Res("ToolbarDialog.Clear")%> <%= Res("Projects.Search.From")%>" title="<%= Res("ToolbarDialog.Clear")%>" />
</div>
私の AngularJS コントローラーは次のようになります。
function ProjectSearchCtrl($scope) {
$scope.startDate = '';
$scope.hasStartDate = function () {
return $scope.startDate != '';
};
$scope.clearStartDate = function () {
$scope.startDate = '';
};
$scope.dateOptions = {
dateFormat: "yy-mm-dd",
showOn: "focus"
};
}
これは完全に機能します。AngularUIのおかげでdatepickerが正しく設定されており、AngularJSバインディングが機能しています...
しかし、showOn 値を「button」または「both」(実際に日付ピッカー ボタンを表示する 2 つの可能なオプション) に変更すると、入力の後のすべて (ui-date 属性を含む) が機能しなくなります: ng-show、ng-クリック...コントローラーは呼び出されません。
バージョン (すべて最新):
- jQuery 1.7.2
- angularJS 1.0.0
- angularUI 0.1.0
- クローム 20