I'm currently using Angular and Require in a project for the first time. At the moment it seems like it's very hard to do the things that should be simple when using Angular.
I'm currently trying to put a click event using jQuery for a simple tabbed menu and of course, $(document).ready will not work because Angular loads the views after this has fired. Are there any examples of how to implement jQuery plugins with Angular (and Require)?
Also, I will need to turn jQuery plugins on/off on window resize using another plugin. What is the correct method of doing these things? Any help would be greatly appreciated.
I've attached some (very) stripped down code from a controller. I have also tried putting the click event straight between the angular.element ready code. Still doesn't seem to work.
define(['app', 'modules/Social'], function(app, social) {
'use strict';
return app.controller('HomeCtrl', function($scope, $http) {
angular.element(document).ready(function () {
// This code attaches an event listener in jQuery (.click())
social.init();
});
});
});
EDIT: I am using includes as templating and it appears that the includes are getting fired AFTER the angular.element ready function. Which means it is not adding the event listener.