Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate html code from typescript file #20

Closed
nirojdyola opened this issue Aug 31, 2017 · 5 comments
Closed

Separate html code from typescript file #20

nirojdyola opened this issue Aug 31, 2017 · 5 comments
Assignees

Comments

@nirojdyola
Copy link
Contributor

Make a separate html file for each component. Don;t include the html code in typescript file . It is just for structure maintaining so that easy to find the bug .

@paulbert
Copy link
Member

paulbert commented Sep 4, 2017

Could you explain in more detail how this makes it easier to find bugs? I think it's more easily maintainable to leave HTML in the typescript file for small templates because then you only have one file to work with when making changes.

@paulbert
Copy link
Member

paulbert commented Sep 4, 2017

Also, adding this to the planet alpha project. Please add all issues to this project, thanks!

@razu9861
Copy link
Contributor

razu9861 commented Oct 17, 2017

@paulbert we were moving html files to .html files sho that the comonents ts will look more clean, but if there are few lines of html codes like tables and fetchig data on tables, or creating buttons we can use components ts but for longer files like creating multiple templates and creating multiples forms etc. it is easy to use .html

@paulbert
Copy link
Member

@razu9861 @nirojdyola I think we should keep the HTML and SCSS in the component.ts file if there are fewer than 12 lines total OR if someone makes a good case for keeping it in.

At that length the HTML/SCSS still doesn't obscure the JavaScript, and we can keep a flatter folder structure with fewer files.

An example of what I'd call a good case is the page-not-found component because there is no JavaScript functionality in the component so the HTML in that case can stay in the component.ts file. Since it's already in the repository as separate files, I don't think we need to change this now, though.

If that sounds good, then the one file that we should change is the login.component.ts to move its template into a login.component.html file.

@paulbert
Copy link
Member

Closing this as most, if not all, files follow the style guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants