{"action":"created","issue":{"url":"https://api.github.com/repos/swagger-api/swagger-ui/issues/4303","repository_url":"https://api.github.com/repos/swagger-api/swagger-ui","labels_url":"https://api.github.com/repos/swagger-api/swagger-ui/issues/4303/labels{/name}","comments_url":"https://api.github.com/repos/swagger-api/swagger-ui/issues/4303/comments","events_url":"https://api.github.com/repos/swagger-api/swagger-ui/issues/4303/events","html_url":"https://github.com/swagger-api/swagger-ui/issues/4303","id":303423048,"number":4303,"title":"Angular5: ERROR TypeError: Cannot read property 'presets' of undefined","user":{"login":"yulogs","id":5194613,"avatar_url":"https://avatars1.githubusercontent.com/u/5194613?v=4","gravatar_id":"","url":"https://api.github.com/users/yulogs","html_url":"https://github.com/yulogs","followers_url":"https://api.github.com/users/yulogs/followers","following_url":"https://api.github.com/users/yulogs/following{/other_user}","gists_url":"https://api.github.com/users/yulogs/gists{/gist_id}","starred_url":"https://api.github.com/users/yulogs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yulogs/subscriptions","organizations_url":"https://api.github.com/users/yulogs/orgs","repos_url":"https://api.github.com/users/yulogs/repos","events_url":"https://api.github.com/users/yulogs/events{/privacy}","received_events_url":"https://api.github.com/users/yulogs/received_events","type":"User","site_admin":false},"labels":[{"id":185046751,"url":"https://api.github.com/repos/swagger-api/swagger-ui/labels/type:%20support","name":"type: support","color":"bfdadc","default":false}],"state":"open","locked":false,"assignee":{"login":"shockey","id":680248,"avatar_url":"https://avatars2.githubusercontent.com/u/680248?v=4","gravatar_id":"","url":"https://api.github.com/users/shockey","html_url":"https://github.com/shockey","followers_url":"https://api.github.com/users/shockey/followers","following_url":"https://api.github.com/users/shockey/following{/other_user}","gists_url":"https://api.github.com/users/shockey/gists{/gist_id}","starred_url":"https://api.github.com/users/shockey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shockey/subscriptions","organizations_url":"https://api.github.com/users/shockey/orgs","repos_url":"https://api.github.com/users/shockey/repos","events_url":"https://api.github.com/users/shockey/events{/privacy}","received_events_url":"https://api.github.com/users/shockey/received_events","type":"User","site_admin":false},"assignees":[{"login":"shockey","id":680248,"avatar_url":"https://avatars2.githubusercontent.com/u/680248?v=4","gravatar_id":"","url":"https://api.github.com/users/shockey","html_url":"https://github.com/shockey","followers_url":"https://api.github.com/users/shockey/followers","following_url":"https://api.github.com/users/shockey/following{/other_user}","gists_url":"https://api.github.com/users/shockey/gists{/gist_id}","starred_url":"https://api.github.com/users/shockey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shockey/subscriptions","organizations_url":"https://api.github.com/users/shockey/orgs","repos_url":"https://api.github.com/users/shockey/repos","events_url":"https://api.github.com/users/shockey/events{/privacy}","received_events_url":"https://api.github.com/users/shockey/received_events","type":"User","site_admin":false}],"milestone":null,"comments":5,"created_at":"2018-03-08T10:06:23Z","updated_at":"2018-03-15T05:37:00Z","closed_at":null,"author_association":"NONE","body":"I want  plugin to my angular5 project, but cound not success,\r\nI add dependencies to package.json like this: \"swagger-ui\": \"^3.12.0\",\r\n\r\n1. I get a project: https://github.com/shockey/swagger-ui-angular4\r\n2. Change angualr4 to angualr5\r\n\r\nBut it has this error:\r\nAppComponent.html:10 ERROR TypeError: Cannot read property 'presets' of undefined\r\n\r\nWhy this error? Thank you\r\n \r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/swagger-api/swagger-ui/issues/comments/373266496","html_url":"https://github.com/swagger-api/swagger-ui/issues/4303#issuecomment-373266496","issue_url":"https://api.github.com/repos/swagger-api/swagger-ui/issues/4303","id":373266496,"user":{"login":"shockey","id":680248,"avatar_url":"https://avatars2.githubusercontent.com/u/680248?v=4","gravatar_id":"","url":"https://api.github.com/users/shockey","html_url":"https://github.com/shockey","followers_url":"https://api.github.com/users/shockey/followers","following_url":"https://api.github.com/users/shockey/following{/other_user}","gists_url":"https://api.github.com/users/shockey/gists{/gist_id}","starred_url":"https://api.github.com/users/shockey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shockey/subscriptions","organizations_url":"https://api.github.com/users/shockey/orgs","repos_url":"https://api.github.com/users/shockey/repos","events_url":"https://api.github.com/users/shockey/events{/privacy}","received_events_url":"https://api.github.com/users/shockey/received_events","type":"User","site_admin":false},"created_at":"2018-03-15T05:36:59Z","updated_at":"2018-03-15T05:36:59Z","author_association":"CONTRIBUTOR","body":"@mckennajones no worries!\n\nI've isolated the problem: I believe the Angular compiler is handling ES6 modules differently in version 5:\n\n```js\n// Unminified code\n\nimport SwaggerUI from \"swagger-ui\"\n\n@Component({\n  selector: 'app-root',\n  templateUrl: './app.component.html',\n  styleUrls: ['./app.component.css']\n})\n\nexport class AppComponent implements AfterViewInit {\n  ngAfterViewInit() {\n    const ui = SwaggerUI({\n      url: 'http://petstore.swagger.io/v2/swagger.json',\n      domNode: this.el.nativeElement.querySelector('#ui'),\n      deepLinking: true,\n      presets: [\n        SwaggerUI.presets.apis\n      ],\n    });\n  }\n\n}\n```\n\n```js\n// Minified code\nvar swagger_ui_1 = __webpack_require__(\"./node_modules/swagger-ui/dist/swagger-ui.js\");\nvar AppComponent = /** @class */ (function () {\n    function AppComponent(el) {\n        this.el = el;\n    }\n    AppComponent.prototype.ngAfterViewInit = function () {\n        var ui = swagger_ui_1.default({\n            url: 'http://petstore.swagger.io/v2/swagger.json',\n            domNode: this.el.nativeElement.querySelector('#ui'),\n            deepLinking: true,\n            presets: [\n                swagger_ui_1.default.presets.apis\n            ],\n        });\n    };\n    AppComponent = __decorate([\n        core_1.Component({\n            selector: 'app-root',\n            template: __webpack_require__(\"./src/app/app.component.html\"),\n            styles: [__webpack_require__(\"./src/app/app.component.css\")]\n        })\n        ,\n        __metadata(\"design:paramtypes\", [core_1.ElementRef])\n    ], AppComponent);\n    return AppComponent;\n}());\nexports.AppComponent = AppComponent;\n```\n\nNote the `swagger_ui_1.default`: Angular 5's compiler (I assume it's the compiler...) is inferring that the ES6 module import needs to reach into the `default` property. Our module doesn't do that though: our top-level file exports a function directly:\n\nhttps://github.com/swagger-api/swagger-ui/blob/master/src/core/index.js#L17"}}
{"actor":{"display_login":"shockey"}}