starter.directive('itemWrite', [function () { return { restrict: "E", scope: { item: "=itemData" }, templateUrl: 'templates/template-itemWrite.html', controller: function ($scope, $cordovaDatePicker) { $scope.selectedChange = function (value) { $scope.item.text = value; } $scope.chooseDate = function (datetime) { var options = { mode: 'date', date: new Date(), androidTheme: 3 }; $cordovaDatePicker.show(options).then(function (date) { if (date == undefined) return; $scope.item.datetime_data = date; }); } if ($scope.item.t__type in [1, 4]) { if ($scope.item.required) { $scope.note = '输入内容'; } else { $scope.note = '输入内容(选填)'; } } else if ($scope.item.t__type in [2, 3, 5]) { if ($scope.item.t__type == 5) { if ($scope.item.select_data == undefined) $scope.item.select_data = $scope.item.selecttext; data = JSON.parse($scope.item.extra) data = _.pluck(data, 'text') $scope.selectData = data; } if (!$scope.item.required) $scope.note = '(选填)'; } } } }]) .directive('setClassWhenAtTop', function ($window) { var $win = angular.element($window); return { restrict: 'A', link: function (scope, element, attrs) { var topClass = attrs.setClassWhenAtTop, offsetTop = element[0].offsetTop; $win.on('scroll', function (e) { if ($win.scrollTop() >= 44) { element.addClass(topClass); } else { element.removeClass(topClass); } }); } }; }) .directive('daily', function () { return { restrict: "E", scope: { dailys: "=dailys", loading: "=loading" }, templateUrl: 'templates/template-daily.html', controller: function ($scope, $state, Daily) { $scope.todetails = function (daily) { Daily.daily = _.clone(daily); $state.go('daily-details', { 'id': daily.id }); } } } }) .directive('dailyHeader', function () { return { restrict: "E", scope: { daily: "=daily" }, template: '
{{daily.create_date | date:"MM-dd HH:mm"}}
日报({{daily.daily_dd | date:"M月d日"}})