I'm having an issue with the ng-show method in that I set the method as follows:
I check the length of the username string however even though it reports the correct length the ng-show method doesn't hide / show the extra text for me until the key stroke after. How can I get it to update the visibility of the username helper text on the key up
How if you look in the JS fiddle http://jsfiddle.net/FkAkg/8/
accountApp.directive("stripCharacters", ['$filter', '$http', function($filter, $http) {
return {
restrict: 'C',
link: function(scope, element) {
element.bind("keyup", function() {
if(scope.account.username !== undefined) {
element.val($filter('stripCharacters')(scope.account.username));
if(scope.account.username.length > 2) {
scope.toggleShowUsername(true);
scope.usernameMessage = scope.account.usernameAvailable;
} else {
scope.toggleShowUsername(false);
}
}
});
}
}
}]);
I've gotten it to work with replacing this with jQuery hide/show on the same element but was hoping to get it working in angular only.
Cheers