I've just started using Angular.js and as I normally do, I quickly jumped to including jquery and a custom.js file where I have all the custom, small jquery snippets like on click events, etc.
Naturally, this didn't work.
Did some reading, turns out I have to use ng-click.
So, managed to get one snippet working by declaring this into my controller:
$scope.alert = function(text) {
alert("YES!");
};
As you might imagine, not ideal.
Question is:
How can I have one custom.js file, or a service, or something, in which all the jquery snippets can be contained, and I can just call them with ng-click="alert" for example, or something like that.
I tried building a service for it, but I couldn't get it to work properly. The only service I built is also the only way I know to serve images in Angular, and that is:
'use strict';
//Image service
angular.module('mean.system').factory('ImageSol', [
function() {
return {
logo : 'public/system/assets/img/logo-sol.png'
};
}
]);
To me it really seems excessive for just being able to serve a single image or a single jquery snippet.