Use a function, way more readable:
ng-init=”init()”
And:
$scope.init = function() {
$scope.a = 1;
$scope.b = 2;
}
Or, if you must, separate inline variables with a semi-colon:
ng-init=”a = 1; b = 2″
Use a function, way more readable:
ng-init=”init()”
And:
$scope.init = function() {
$scope.a = 1;
$scope.b = 2;
}
Or, if you must, separate inline variables with a semi-colon:
ng-init=”a = 1; b = 2″
app.directive(‘disallowSpaces’, function() {
return {
restrict: ‘A’,
link: function($scope, $element) {
$element.bind(‘input’, function() {
$(this).val($(this).val().replace(/ /g, ”));
});
}
};
});
This directive can be invoked like this:
<input type=”text” disallow-spaces>
The Art and Craft of Blogging
LEARN > SHARE > MASTER