I am creating an aurelia application and have recently purchased a template which is using angular.
The template has a large number of directives for jquery/js helpers for it's pages and html elements.
Having only started to learn aurelia I am not sure the correct way to port these over, here's an example
.directive('fgLine', function(){
return {
restrict: 'C',
link: function(scope, element) {
if($('.fg-line')[0]) {
$('body').on('focus', '.form-control', function(){
$(this).closest('.fg-line').addClass('fg-toggled');
})
$('body').on('blur', '.form-control', function(){
var p = $(this).closest('.form-group');
var i = p.find('.form-control').val();
if (p.hasClass('fg-float')) {
if (i.length == 0) {
$(this).closest('.fg-line').removeClass('fg-toggled');
}
}
else {
$(this).closest('.fg-line').removeClass('fg-toggled');
}
});
}
}
}
})
The directive is targeting a css selector and adding events to it.
Should this be a custom element? Can anyone point me in the right direction on how this should look in an aurelia way?