Skip to content

Commit

Permalink
fix: throw exception if fa-elements are added to fa-surface
Browse files Browse the repository at this point in the history
  • Loading branch information
rajatkhanna82 committed Aug 11, 2014
1 parent 864bd8b commit 60c8fe0
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 5 deletions.
7 changes: 6 additions & 1 deletion dist/famous-angular.js
Original file line number Diff line number Diff line change
Expand Up @@ -4087,12 +4087,15 @@ angular.module('famous.angular')
if (attrs.class) {
isolate.renderNode.setClasses(attrs['class'].split(' '));
}
$famousDecorator.sequenceWith(scope, function(data) {
throw new Error('Cannot add FA- elements in fa-surface');
});
},
post: function(scope, element, attrs){
var isolate = $famousDecorator.ensureIsolate(scope);

var updateContent = function() {
isolate.renderNode.setContent(element[0].querySelector('div.fa-surface'));
isolate.renderNode.setContent(element[0].querySelector('div.fa-surface'));
};

updateContent();
Expand All @@ -4110,6 +4113,8 @@ angular.module('famous.angular')
$famousDecorator.registerChild(scope, element, isolate, function() {
// TODO: hook into RenderController and hide this render node
});


}
};
}
Expand Down
2 changes: 1 addition & 1 deletion dist/famous-angular.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion famous-angular-docs
2 changes: 1 addition & 1 deletion famous-angular-examples
8 changes: 7 additions & 1 deletion src/scripts/directives/fa-surface.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,16 @@ angular.module('famous.angular')
if (attrs.class) {
isolate.renderNode.setClasses(attrs['class'].split(' '));
}
// Throw an exception if anyother famous scene graph element is added on fa-surface.
$famousDecorator.sequenceWith(scope, function(data) {
throw new Error('Fa-surface cannot contain a scene graph element unless enclosed in an fa-app');
});
},
post: function(scope, element, attrs){
var isolate = $famousDecorator.ensureIsolate(scope);

var updateContent = function() {
isolate.renderNode.setContent(element[0].querySelector('div.fa-surface'));
isolate.renderNode.setContent(element[0].querySelector('div.fa-surface'));
};

updateContent();
Expand All @@ -227,6 +231,8 @@ angular.module('famous.angular')
$famousDecorator.registerChild(scope, element, isolate, function() {
// TODO: hook into RenderController and hide this render node
});


}
};
}
Expand Down
1 change: 1 addition & 0 deletions src/scripts/famous
Submodule famous added at 81850e

0 comments on commit 60c8fe0

Please sign in to comment.