Open Guria opened 9 years ago
@Guria i think about this. Thanks!
working example for input:
modules.define('angular-bem', ['jquery'], function(provide, $, ngBem) {
provide(ngBem.directive('inputAngular', function() {
return {
restrict : 'C',
require : '?ngModel',
link : function(scope, element, attrs, ngModel) {
if(!ngModel) return;
var input = $(element).bem('input');
ngModel.$render = function() {
input.setVal(ngModel.$viewValue || '');
};
input.on('change', function() {
scope.$evalAsync(read);
});
read();
function read() {
ngModel.$setViewValue(input.getVal());
}
}
}
}));
});
Cool!!!
We can list here bem-components blocks that need such directives.
Define directive in template for each block from bem-components. In directives:
Maybe it should be implemented in separate repo.