{"action":"created","issue":{"url":"https://api.github.com/repos/formly-js/angular-formly/issues/333","labels_url":"https://api.github.com/repos/formly-js/angular-formly/issues/333/labels{/name}","comments_url":"https://api.github.com/repos/formly-js/angular-formly/issues/333/comments","events_url":"https://api.github.com/repos/formly-js/angular-formly/issues/333/events","html_url":"https://github.com/formly-js/angular-formly/issues/333","id":85212351,"number":333,"title":"var vm = this; doesn't work...have to use $scope..why is that?","user":{"login":"sharpmachine","id":600836,"avatar_url":"https://avatars.githubusercontent.com/u/600836?v=3","gravatar_id":"","url":"https://api.github.com/users/sharpmachine","html_url":"https://github.com/sharpmachine","followers_url":"https://api.github.com/users/sharpmachine/followers","following_url":"https://api.github.com/users/sharpmachine/following{/other_user}","gists_url":"https://api.github.com/users/sharpmachine/gists{/gist_id}","starred_url":"https://api.github.com/users/sharpmachine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sharpmachine/subscriptions","organizations_url":"https://api.github.com/users/sharpmachine/orgs","repos_url":"https://api.github.com/users/sharpmachine/repos","events_url":"https://api.github.com/users/sharpmachine/events{/privacy}","received_events_url":"https://api.github.com/users/sharpmachine/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-06-04T18:12:15Z","updated_at":"2015-06-04T22:58:05Z","closed_at":null,"body":"So I was attempting to set up formly in my project using the examples in the documentation.  Everywhere you use 'vm' I did as well.  And nothing worked.  It's only when I used $scope.whatever rather than vm.whatever did it work.\r\n\r\nWhy is that?\r\n\r\nNo workie:\r\n\r\n```javascript\r\n  var vm = this;\r\n\r\n vm.user = {\r\n    email: 'jesse@jkad.com'\r\n  };\r\n\r\nvm.userFields = [\r\n    {\r\n      key: 'email',\r\n      type: 'input',\r\n      templateOptions: {\r\n        type: 'email',\r\n        label: 'Email address',\r\n        placeholder: 'Enter email'\r\n      }\r\n    },\r\n    {\r\n      key: 'password',\r\n      type: 'input',\r\n      templateOptions: {\r\n        type: 'password',\r\n        label: 'Password',\r\n        placeholder: 'Password'\r\n      }\r\n    },\r\n    {\r\n      key: 'file',\r\n      type: 'file',\r\n      templateOptions: {\r\n        label: 'File input',\r\n        description: 'Example block-level help text here',\r\n        url: 'https://example.com/upload'\r\n      }\r\n    },\r\n    {\r\n      key: 'checked',\r\n      type: 'checkbox',\r\n      templateOptions: {\r\n        label: 'Check me out'\r\n      }\r\n    }\r\n  ];\r\n```\r\n\r\n```html\r\n<formly-form model=\"vm.user\" fields=\"vm.userFields\">\r\n  <button type=\"submit\" class=\"btn btn-default\" ng-click=\"vm.submit(vm.user)\">Submit</button>\r\n</formly-form>\r\n```\r\n\r\nThis works:\r\n\r\n```javascript\r\n  $scope.user = {\r\n    email: 'jesse@jkad.com'\r\n  };\r\n\r\n  $scope.userFields = [\r\n    {\r\n      key: 'email',\r\n      type: 'input',\r\n      templateOptions: {\r\n        type: 'email',\r\n        label: 'Email address',\r\n        placeholder: 'Enter email'\r\n      }\r\n    },\r\n    {\r\n      key: 'password',\r\n      type: 'input',\r\n      templateOptions: {\r\n        type: 'password',\r\n        label: 'Password',\r\n        placeholder: 'Password'\r\n      }\r\n    },\r\n    {\r\n      key: 'file',\r\n      type: 'file',\r\n      templateOptions: {\r\n        label: 'File input',\r\n        description: 'Example block-level help text here',\r\n        url: 'https://example.com/upload'\r\n      }\r\n    },\r\n    {\r\n      key: 'checked',\r\n      type: 'checkbox',\r\n      templateOptions: {\r\n        label: 'Check me out'\r\n      }\r\n    }\r\n  ];\r\n```\r\n\r\n```html\r\n<formly-form model=\"user\" fields=\"userFields\">\r\n  <button type=\"submit\" class=\"btn btn-default\" ng-click=\"submit(user)\">Submit</button>\r\n</formly-form>\r\n```"},"comment":{"url":"https://api.github.com/repos/formly-js/angular-formly/issues/comments/109081037","html_url":"https://github.com/formly-js/angular-formly/issues/333#issuecomment-109081037","issue_url":"https://api.github.com/repos/formly-js/angular-formly/issues/333","id":109081037,"user":{"login":"ckniffen","id":464895,"avatar_url":"https://avatars.githubusercontent.com/u/464895?v=3","gravatar_id":"","url":"https://api.github.com/users/ckniffen","html_url":"https://github.com/ckniffen","followers_url":"https://api.github.com/users/ckniffen/followers","following_url":"https://api.github.com/users/ckniffen/following{/other_user}","gists_url":"https://api.github.com/users/ckniffen/gists{/gist_id}","starred_url":"https://api.github.com/users/ckniffen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ckniffen/subscriptions","organizations_url":"https://api.github.com/users/ckniffen/orgs","repos_url":"https://api.github.com/users/ckniffen/repos","events_url":"https://api.github.com/users/ckniffen/events{/privacy}","received_events_url":"https://api.github.com/users/ckniffen/received_events","type":"User","site_admin":false},"created_at":"2015-06-04T22:58:05Z","updated_at":"2015-06-04T22:58:05Z","body":"You don't have to use controllerAs to work with formly.  The examples are just typically written that way."}}