I am using the 5 min quickstart from angular.io website, which contain a file structure like this:
angular2-quickstart
app
app.component.ts
boot.ts
i
I tried the solutions listed here. They are good, but not ideal for me. I want a simple solution. I don't want to hard-code the path information in all my component files. I don't want to install more npm packages to take care of this.
So I come up an easiest alternative. It's not a direct answer to this question, but it works very well for me.
I just tweak my workspace settings so that the js files under /app don't show. They are still there. They are just hidden from my workspace. To me, that's enough.
I'm using Sublime Text, so here is what I have for my project settings:
"file_exclude_patterns": ["app/*.js"]
I'm sure many other editors have similar functions.
UPDATE:
Just use Angular CLI. Everything is taken care of automatically.