{"action":"created","issue":{"url":"https://api.github.com/repos/driftyco/ionic/issues/6577","repository_url":"https://api.github.com/repos/driftyco/ionic","labels_url":"https://api.github.com/repos/driftyco/ionic/issues/6577/labels{/name}","comments_url":"https://api.github.com/repos/driftyco/ionic/issues/6577/comments","events_url":"https://api.github.com/repos/driftyco/ionic/issues/6577/events","html_url":"https://github.com/driftyco/ionic/issues/6577","id":155694653,"number":6577,"title":"$ionicView.beforeEnter is not fired","user":{"login":"didlich","id":1636774,"avatar_url":"https://avatars.githubusercontent.com/u/1636774?v=3","gravatar_id":"","url":"https://api.github.com/users/didlich","html_url":"https://github.com/didlich","followers_url":"https://api.github.com/users/didlich/followers","following_url":"https://api.github.com/users/didlich/following{/other_user}","gists_url":"https://api.github.com/users/didlich/gists{/gist_id}","starred_url":"https://api.github.com/users/didlich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/didlich/subscriptions","organizations_url":"https://api.github.com/users/didlich/orgs","repos_url":"https://api.github.com/users/didlich/repos","events_url":"https://api.github.com/users/didlich/events{/privacy}","received_events_url":"https://api.github.com/users/didlich/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/driftyco/ionic/labels/needs%20reply","name":"needs reply","color":"ededed"},{"url":"https://api.github.com/repos/driftyco/ionic/labels/v1","name":"v1","color":"888888"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-05-19T09:41:25Z","updated_at":"2016-05-20T15:21:11Z","closed_at":null,"body":"after the update from\r\nionic 1.3.0 to 1.3.1\r\nthe $ionicView.beforeEnter is not fired any more as before\r\n\r\nI have this controller:\r\n```typescript\r\nclass MyCtrl {\r\n static $inject = [   \r\n    \"$scope\"\r\n  ];\r\n  constructor(\r\n    private $scope\r\n  ) { \r\n    $scope.$on(\"$ionicView.beforeEnter\", (event, data) => {\r\n      this.activate();\r\n    });\r\n  }\r\n}\r\n```\r\n\r\nin version 1.3.0 the activate() method is called as expected\r\nin version 1.3.1 the activate() method is not called\r\n\r\nthe fix is to roll back to version 1.3.0\r\n"},"comment":{"url":"https://api.github.com/repos/driftyco/ionic/issues/comments/220635646","html_url":"https://github.com/driftyco/ionic/issues/6577#issuecomment-220635646","issue_url":"https://api.github.com/repos/driftyco/ionic/issues/6577","id":220635646,"user":{"login":"darthdie","id":4060546,"avatar_url":"https://avatars.githubusercontent.com/u/4060546?v=3","gravatar_id":"","url":"https://api.github.com/users/darthdie","html_url":"https://github.com/darthdie","followers_url":"https://api.github.com/users/darthdie/followers","following_url":"https://api.github.com/users/darthdie/following{/other_user}","gists_url":"https://api.github.com/users/darthdie/gists{/gist_id}","starred_url":"https://api.github.com/users/darthdie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/darthdie/subscriptions","organizations_url":"https://api.github.com/users/darthdie/orgs","repos_url":"https://api.github.com/users/darthdie/repos","events_url":"https://api.github.com/users/darthdie/events{/privacy}","received_events_url":"https://api.github.com/users/darthdie/received_events","type":"User","site_admin":false},"created_at":"2016-05-20T15:21:11Z","updated_at":"2016-05-20T15:21:11Z","body":"In my testing it appears this was broken in commit d63733350b73c0084f99fe285dda96f0204b2cd7\r\n\r\nSpecifically the following line returns null (thus it then has no scope to emit events to)\r\n```javascript\r\nvar enteringScope = getScopeForElement(enteringEle, enteringData);\r\n```\r\n\r\nFrom further testing it appears it returns null because inside of `getScopeForElement`\r\n\r\n```javascript\r\n    if ( attributeValue !== \"true\" ) {\r\n      // it's not an abstract view, so make sure the element\r\n      // matches the state.  Due to abstract view weirdness,\r\n      // sometimes it doesn't. If it doesn't, don't dispatch events\r\n      // so leave the scope undefined\r\n      if ( stateValue === stateData.stateName ) {\r\n        return angular.element(element).scope();\r\n      }\r\n      return null;\r\n    }\r\n```\r\n\r\nThe condition `if ( stateValue === stateData.stateName )` is false because stateValue is null. (At least in my particular case)\r\n\r\nIn case anybody is interested (and/or needs these events to fire like myself) for now I've patched it simply by merging the original with the new (inside of the `emit` function in \"$ionicViewSwitcher\"), i.e.\r\n```javascript\r\nvar enteringScope = getScopeForElement(enteringEle, enteringData) || enteringEle.scope();\r\n```"}}
{"actor":{"display_login":"darthdie"}}