Skip to content

Commit

Permalink
feat: support removing children from fa-header-footer-layout
Browse files Browse the repository at this point in the history
Merge branch 'patch-7' of github.com:bguiz/famous-angular into bguiz-patch-7
  • Loading branch information
zackbrown committed Sep 9, 2014
2 parents a4d7f45 + 9c38f6f commit 01fefee
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/scripts/directives/fa-header-footer-layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ angular.module('famous.angular')

$famousDecorator.sequenceWith(
scope,
function(data) {
function addChild(data) {
_numberOfChildren++;
if (_numberOfChildren === 1) {
isolate.renderNode.header.add(data.renderGate);
Expand All @@ -121,9 +121,15 @@ angular.module('famous.angular')
throw new Error('fa-header-footer-layout can accept no more than 3 children');
}
},
// TODO: support removing children
function(childScopeId) {
throw new Error ('unimplemented: fa-header-footer-layout does not support removing children');
function removeChild(childScopeId) {
if (_numberOfChildren === 1) {
isolate.renderNode.header.set({});
} else if (_numberOfChildren === 2){
isolate.renderNode.content.set({});
} else if (_numberOfChildren === 3){
isolate.renderNode.footer.set({});
}
_numberOfChildren--;
}
);

Expand Down

0 comments on commit 01fefee

Please sign in to comment.