AngularJS Transclusion Experiment
With transclusion!
HTML
<script src="http://code.angularjs.org/1.0.1/angular-1.0.1.js"></script>
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">
<div ng-controller="MyCtrl">
<button type="button" class="btn btn-default" ng-click="createRequestRecoverySupportTask()"
title="{{requestRecoverySupportTaskDisabledTitle()}}"
ng-disabled="isRequestRecoverySupportTaskDisabled()">
<span class="fa fa-check-square-o"></span>
button
</button>
</div>
JavaScript
var myModule = angular.module('myModule', [])
.controller('MyCtrl', ['$scope', function ($scope) {
var requestRecoverySupportTaskDisabled = true;
$scope.isRequestRecoverySupportTaskDisabled = function () {
return requestRecoverySupportTaskDisabled;
};
// $scope.msg = '';
$scope.requestRecoverySupportTaskDisabledTitle = function () {
return requestRecoverySupportTaskDisabledTitle();
};
var requestRecoverySupportTaskDisabledTitle = function () {
var msg = [];
var claim = $scope.claim;
if (claim.status !== 'open') {
msg.push(Translation.translate('tt.claim_not_open'));
}
//The claim is not dirty (no input from user that is not yet changed)
if ($scope.claimForm.$dirty) {
msg.push(Translation.translate('tt.claim_dirty'));
}
//Responsible office outside of Legal Entity
//Responsible Office→ Legal Entity ID != Managing Office (Claim) → Legal Entity ID
if (!claim.responsibleBranch) {
msg.push(Translation.translate('tt.claim_has_no_rOffice'));
}
if (claim.responsibleBranch.legalEntity.id === claim.managingBranch.legalEntity.id) {
msg.push(Translation.translate('tt.claim_rOffice_outside_of_le'));
}
//Claimed Amount (Claim) < 200€
if (!claim.financialInfo.claimedAmount) {
msg.push(Translation.translate('tt.claim_has_no_claimed_amount'));
}
var claimedAmountInEuro = FinancialStatusService.convertMoney($scope.claim.financialInfo.claimedAmount, 'EUR', rates);
if (claimedAmountInEuro >=...