{"action":"created","issue":{"url":"https://api.github.com/repos/hellsan631/angular-fullpage.js/issues/9","repository_url":"https://api.github.com/repos/hellsan631/angular-fullpage.js","labels_url":"https://api.github.com/repos/hellsan631/angular-fullpage.js/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/hellsan631/angular-fullpage.js/issues/9/comments","events_url":"https://api.github.com/repos/hellsan631/angular-fullpage.js/issues/9/events","html_url":"https://github.com/hellsan631/angular-fullpage.js/issues/9","id":142018339,"number":9,"title":"Assigning events outside of slides","user":{"login":"dtrinh50","id":13661813,"avatar_url":"https://avatars.githubusercontent.com/u/13661813?v=3","gravatar_id":"","url":"https://api.github.com/users/dtrinh50","html_url":"https://github.com/dtrinh50","followers_url":"https://api.github.com/users/dtrinh50/followers","following_url":"https://api.github.com/users/dtrinh50/following{/other_user}","gists_url":"https://api.github.com/users/dtrinh50/gists{/gist_id}","starred_url":"https://api.github.com/users/dtrinh50/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dtrinh50/subscriptions","organizations_url":"https://api.github.com/users/dtrinh50/orgs","repos_url":"https://api.github.com/users/dtrinh50/repos","events_url":"https://api.github.com/users/dtrinh50/events{/privacy}","received_events_url":"https://api.github.com/users/dtrinh50/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-19T02:22:55Z","updated_at":"2016-03-19T04:39:34Z","closed_at":"2016-03-19T04:39:34Z","body":"I am trying to assign an event in the following codes:\r\n```\r\n<div class=\"section\">\r\n<div class=\"slides\" ng-repeat=\"slide in main.slides\">\r\n<!-- data for slides here -->\r\n</div>\r\n<div class=\"move-footer\">\r\n<span class=\"glyphicon glyphicon-menu-up\" data-ng-click=\"main.moveUp()\"></span>\r\n </div>\r\n</div>\r\n```\r\nThe ng-click binding does not work.\r\n\r\nI read the original fullPage.js FAQ, which states:\r\n\r\n> Short answer: if you are using options such as verticalCentered:true or overflowScroll:true in fullPage.js initialization, or even horizontal slides, then you will have to treat your selectors as dynamic elements and use delegation. (by using things such as on from jQuery). Another option is to add your code in the afterRender callback of fullpage.js\r\n\r\nso I tried:\r\n\r\n```\r\nafterRender: function() {\r\n        var vm = $(this);\r\n          vm.moveUp = function() {\r\n            $.fn.fullpage.moveSectionUp();\r\n          };\r\n    }\r\n```\r\n\r\nIs there a way to get my ng-click event to work in this case? Thanks in advance. "},"comment":{"url":"https://api.github.com/repos/hellsan631/angular-fullpage.js/issues/comments/198632270","html_url":"https://github.com/hellsan631/angular-fullpage.js/issues/9#issuecomment-198632270","issue_url":"https://api.github.com/repos/hellsan631/angular-fullpage.js/issues/9","id":198632270,"user":{"login":"hellsan631","id":1474758,"avatar_url":"https://avatars.githubusercontent.com/u/1474758?v=3","gravatar_id":"","url":"https://api.github.com/users/hellsan631","html_url":"https://github.com/hellsan631","followers_url":"https://api.github.com/users/hellsan631/followers","following_url":"https://api.github.com/users/hellsan631/following{/other_user}","gists_url":"https://api.github.com/users/hellsan631/gists{/gist_id}","starred_url":"https://api.github.com/users/hellsan631/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hellsan631/subscriptions","organizations_url":"https://api.github.com/users/hellsan631/orgs","repos_url":"https://api.github.com/users/hellsan631/repos","events_url":"https://api.github.com/users/hellsan631/events{/privacy}","received_events_url":"https://api.github.com/users/hellsan631/received_events","type":"User","site_admin":false},"created_at":"2016-03-19T04:39:34Z","updated_at":"2016-03-19T04:39:34Z","body":"afterRender is an asynchronous call that happens outside of angular regular digest cycle. I also don't recommend binding vm to $(this), as this is a javascript reference to an object, and vm is a naming schema to reference a controller.\r\n\r\nYou would be better off just creating something inside the controller:\r\n```js\r\nfunction HomeController(){\r\n  var vm = this;\r\n  vm.moveUp = moveUp;\r\n\r\n  function moveUp() {\r\n    $.fn.fullpage.moveSectionUp();\r\n  }\r\n}\r\n```\r\n\r\nThe reference to ```this``` is the same as using ```$scope```. there is a great talk on the subject that can be found here on youtube. https://www.youtube.com/watch?v=KdIretrDPhA"}}