Skip to content

Instantly share code, notes, and snippets.

@nachinius
Last active August 29, 2015 14:14
Show Gist options
  • Save nachinius/0a40f4f66cee830bd423 to your computer and use it in GitHub Desktop.
Save nachinius/0a40f4f66cee830bd423 to your computer and use it in GitHub Desktop.
couple of directive
// angular.module('mymodule').directive('showAlertError', function() {
// return {
// restrict: 'E',
// scope: {
// key: '=key',
// alerts: '=alerts'
// },
// template: '<div ng-show="alerts.by_key[key]">{{alerts.by_key[key].message}}</div>',
// link: function(scope, elm, attrs) {
// }
// }
// });
angular.module('mymodule').directive('showIfExists', function() {
return {
restrict: 'E',
scope: {
value: '=value',
},
template: '<div class="error" ng-show="value">{{value}}</div>',
link: function(scope, elm, attrs) {
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment