Skip to content

Instantly share code, notes, and snippets.

@brianpetro
Created August 18, 2016 17:19
Show Gist options
  • Save brianpetro/3d281cd4c13792ed40bab455d09aba07 to your computer and use it in GitHub Desktop.
Save brianpetro/3d281cd4c13792ed40bab455d09aba07 to your computer and use it in GitHub Desktop.
var app = angular.module('myApp', []);
app.controller('accountsSummaryCtrl', function ($scope) {
$scope.assetAccount = {
name: 'Assets',
balance: 4324.00,
subAccounts: [{
name: 'Bank Account',
balance: 2000
}, {
name: 'Cash',
balance: 2324.00
}]
};
});
app.directive('account', function () {
return {
restrict: 'E',
scope: {
account: '=name'
},
template: $('#account-template').html(),
controller: function ($scope, $element, $attrs) {
$scope.subAccountsOpen = false;
$scope.toggleSubAccounts = function () {
$scope.subAccountsOpen = !$scope.subAccountsOpen;
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment