{"action":"created","issue":{"url":"https://api.github.com/repos/embersherpa/ama/issues/12","labels_url":"https://api.github.com/repos/embersherpa/ama/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/embersherpa/ama/issues/12/comments","events_url":"https://api.github.com/repos/embersherpa/ama/issues/12/events","html_url":"https://github.com/embersherpa/ama/issues/12","id":97748631,"number":12,"title":"How to access controller property from function?","user":{"login":"PhilTrue","id":9120283,"avatar_url":"https://avatars.githubusercontent.com/u/9120283?v=3","gravatar_id":"","url":"https://api.github.com/users/PhilTrue","html_url":"https://github.com/PhilTrue","followers_url":"https://api.github.com/users/PhilTrue/followers","following_url":"https://api.github.com/users/PhilTrue/following{/other_user}","gists_url":"https://api.github.com/users/PhilTrue/gists{/gist_id}","starred_url":"https://api.github.com/users/PhilTrue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PhilTrue/subscriptions","organizations_url":"https://api.github.com/users/PhilTrue/orgs","repos_url":"https://api.github.com/users/PhilTrue/repos","events_url":"https://api.github.com/users/PhilTrue/events{/privacy}","received_events_url":"https://api.github.com/users/PhilTrue/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"zinyando","id":806774,"avatar_url":"https://avatars.githubusercontent.com/u/806774?v=3","gravatar_id":"","url":"https://api.github.com/users/zinyando","html_url":"https://github.com/zinyando","followers_url":"https://api.github.com/users/zinyando/followers","following_url":"https://api.github.com/users/zinyando/following{/other_user}","gists_url":"https://api.github.com/users/zinyando/gists{/gist_id}","starred_url":"https://api.github.com/users/zinyando/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zinyando/subscriptions","organizations_url":"https://api.github.com/users/zinyando/orgs","repos_url":"https://api.github.com/users/zinyando/repos","events_url":"https://api.github.com/users/zinyando/events{/privacy}","received_events_url":"https://api.github.com/users/zinyando/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2015-07-28T16:31:46Z","updated_at":"2015-08-25T12:27:36Z","closed_at":null,"body":"in a component I call a web service and save the results in a controller property. \r\n\r\nOn the didInsertElement event I grab a div (Ember.$.('#someDiv')) and initialize the bootstrap fullCalendar widget. Part of that is a handle to a function that fullCalendar calls to get event data for rendering.\r\n\r\nIn my component I have it defined like this:\r\n```js\r\nimport Ember from 'ember';\r\nimport moment from 'moment';\r\nconst {\r\n    on\r\n} = Ember;\r\n\r\nvar calData = {};\r\nvar rcId = {};\r\n\r\nexport default Ember.Component.extend({\r\n    calEvents: function(start, end, timezone, callback) {\r\n        // var scheduleData = this.get('scheduleData');\r\n        var scheduleData = calData;\r\n        ...a whole bunch of logic specific to finding events in my data for fullCalendar to display\r\n        callback(eventData); // calling back to fullcalendar with the events to render\r\n    },\r\n    initialize: on('init', function() {\r\n        var self = this;\r\n        rcId = this.get('rcId');\r\n        Ember.$.ajax({\r\n            url: '/my/big/ugly/Url',\r\n            beforeSend: function(request) {\r\n                request.setRequestHeader('Accept', 'application/json');\r\n            },\r\n            dataType: 'json',\r\n            contentType: 'application/json'\r\n        }).done(function(data) {\r\n            self.set('scheduleData', data);\r\n            calData = data;\r\n        });\r\n    }),\r\n    setupFullCalendar: function() {\r\n        this._super();\r\n        var self = this;\r\n        Ember.$('#fullcal').fullCalendar({\r\n            events: self.get('calEvents'),\r\n        });\r\n    }.on('didInsertElement')\r\n});\r\n```\r\n\r\nAs you can see, I created two variables rcId and calData and populate them so the function can use them. This clearly is not the Ember way.\r\n\r\nIf I reference this.get('calEvents') I get an undefined on get since the context isn't the controller, but rather fullCalendar.\r\n\r\nWhat is the ember way??"},"comment":{"url":"https://api.github.com/repos/embersherpa/ama/issues/comments/134570015","html_url":"https://github.com/embersherpa/ama/issues/12#issuecomment-134570015","issue_url":"https://api.github.com/repos/embersherpa/ama/issues/12","id":134570015,"user":{"login":"taras","id":74687,"avatar_url":"https://avatars.githubusercontent.com/u/74687?v=3","gravatar_id":"","url":"https://api.github.com/users/taras","html_url":"https://github.com/taras","followers_url":"https://api.github.com/users/taras/followers","following_url":"https://api.github.com/users/taras/following{/other_user}","gists_url":"https://api.github.com/users/taras/gists{/gist_id}","starred_url":"https://api.github.com/users/taras/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taras/subscriptions","organizations_url":"https://api.github.com/users/taras/orgs","repos_url":"https://api.github.com/users/taras/repos","events_url":"https://api.github.com/users/taras/events{/privacy}","received_events_url":"https://api.github.com/users/taras/received_events","type":"User","site_admin":false},"created_at":"2015-08-25T12:27:36Z","updated_at":"2015-08-25T12:27:36Z","body":"@zinyando can you please fork `ember-cli-full-calendar` and add the following to it\r\n\r\n[ ] In Dummy app, create a route that renders the calendar with some sample data\r\n[ ] Write a test that checks that this data is rendered\r\n[ ] In Dummy app, create a route that renders initial data and after 2000ms injects additional data\r\n[ ] Write test that shows that both initial data and new data is rendered"}}