{"action":"created","issue":{"url":"https://api.github.com/repos/danialfarid/ng-file-upload/issues/1658","repository_url":"https://api.github.com/repos/danialfarid/ng-file-upload","labels_url":"https://api.github.com/repos/danialfarid/ng-file-upload/issues/1658/labels{/name}","comments_url":"https://api.github.com/repos/danialfarid/ng-file-upload/issues/1658/comments","events_url":"https://api.github.com/repos/danialfarid/ng-file-upload/issues/1658/events","html_url":"https://github.com/danialfarid/ng-file-upload/issues/1658","id":171944479,"number":1658,"title":"ngf-resize-if resizeCondition() being called after ngf-resize resizeOption()/cannot pass the width or height to the resizeOption() function with resizeOption($height, $width) ","user":{"login":"sethkrantzler","id":16142625,"avatar_url":"https://avatars.githubusercontent.com/u/16142625?v=3","gravatar_id":"","url":"https://api.github.com/users/sethkrantzler","html_url":"https://github.com/sethkrantzler","followers_url":"https://api.github.com/users/sethkrantzler/followers","following_url":"https://api.github.com/users/sethkrantzler/following{/other_user}","gists_url":"https://api.github.com/users/sethkrantzler/gists{/gist_id}","starred_url":"https://api.github.com/users/sethkrantzler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sethkrantzler/subscriptions","organizations_url":"https://api.github.com/users/sethkrantzler/orgs","repos_url":"https://api.github.com/users/sethkrantzler/repos","events_url":"https://api.github.com/users/sethkrantzler/events{/privacy}","received_events_url":"https://api.github.com/users/sethkrantzler/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-18T16:28:50Z","updated_at":"2016-08-23T19:19:35Z","closed_at":null,"body":"Hello,\r\n\r\nLove the directive but I've got this issue that is bugging me. The ngf-resize-if is firing after the resize function, and I need that not to be the case so I can tell which of my height/width parameters to lock at 500 (while maintaining the aspect ratio). I would love it if it could tell which parameter is bigger and lock that at 500 basically. The solution below would work if the resize wasn't called before the if statement, as the if statement handles the logic for which object parameter to set. If there is another way to do this that would be great.\r\n\r\nIn my html I have \r\n\r\n  <button class=\"btn btn-info\" role=\"button\" type=\"file\" ng-model=\"tournFile\" ngf-resize=\"resizeOptions()\" ngf-resize-if=\"resizeCondition($file, $width, $height)\" ngf-select=\"uploadTourImgFile($file, $invalidFiles)\"\r\n                      accept=\"image/*\" ngf-max-height=\"1000\" ngf-max-size=\"2MB\"><span style=\"position:relative; left:-6px; color:white; margin-left:4px\" class=\"glyphicon glyphicon-file\"></span>\r\n                      SELECT FILE\r\n                  </button>\r\n\r\nIn my controller I have \r\n\r\n$scope.width = false;\r\n  $scope.height = false;\r\n  $scope.resizeConditions = function(f, w, h){\r\n    console.log(w, h);\r\n    if (w>500 || h>500) {\r\n      if (w>h) {\r\n        console.log(\"hey\");\r\n        $scope.width = true\r\n      }\r\n      else {\r\n        console.log(\"hello\");\r\n        $scope.height = true;\r\n      }\r\n      return true;\r\n    }\r\n    return false;\r\n\r\n  }\r\n  $scope.resizeOptions = function(){\r\n    console.log();\r\n    if ($scope.width) {\r\n      $scope.width = false;\r\n      $scope.height = false;\r\n      console.log(\"or in here?\");\r\n      return {width: 500};\r\n    }\r\n    else {\r\n      $scope.width = false;\r\n      $scope.height = false;\r\n      console.log(\"im in here?\");\r\n      return {height: 500};\r\n    }\r\n\r\n  }\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/danialfarid/ng-file-upload/issues/comments/241846295","html_url":"https://github.com/danialfarid/ng-file-upload/issues/1658#issuecomment-241846295","issue_url":"https://api.github.com/repos/danialfarid/ng-file-upload/issues/1658","id":241846295,"user":{"login":"danialfarid","id":1676054,"avatar_url":"https://avatars.githubusercontent.com/u/1676054?v=3","gravatar_id":"","url":"https://api.github.com/users/danialfarid","html_url":"https://github.com/danialfarid","followers_url":"https://api.github.com/users/danialfarid/followers","following_url":"https://api.github.com/users/danialfarid/following{/other_user}","gists_url":"https://api.github.com/users/danialfarid/gists{/gist_id}","starred_url":"https://api.github.com/users/danialfarid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danialfarid/subscriptions","organizations_url":"https://api.github.com/users/danialfarid/orgs","repos_url":"https://api.github.com/users/danialfarid/repos","events_url":"https://api.github.com/users/danialfarid/events{/privacy}","received_events_url":"https://api.github.com/users/danialfarid/received_events","type":"User","site_admin":false},"created_at":"2016-08-23T19:19:35Z","updated_at":"2016-08-23T19:19:35Z","body":"It would be called after. Create a jsfiddle with steps to reproduce."}}
{"actor":{"display_login":"danialfarid"}}