Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Use templateUrl instead. Keep your html and JavaScript in separate files as recommended.
-
JTBringe6098y@axelbr It's probably because Angular uses an MVC design pattern, just like ASP.NET can, and you fetch properties from somewhere and mix it with HTML. Hence why it's so similar.
-
Bikonja23868yAs far as I can tell this is a template, which is meant to be combined because you have to have some kind of placeholders in the html for actual values, the point is to not have complex/business logic inside the presentation layer. The presentation layer itself does consist of HTML and JS, though... Granted, it's normally separated in different files, but for such a small template it might br worth combining it if it doesn't violate any other rules of the project
-
bt1415161338yWe have the html in a seperate file and use
template: require('relative/path')
in the @Component section of the ts file, much cleaner in my opinion! -
Huuugo25208yWhile it's true that in the old days we had all mixed up with inline styles (or even font tags) and JS in attributes, I think the current trend suggests that we did the split at the wrong place. Instead of splitting by technology or layer (HTML for view, JS for fancy interaction, CSS for layout and styling) many people now think the we should instead split by logical components, features etc. This is the reason for all the new fancy Web components based JS frameworks. In backend we see the same: microservices are small isolated features stretching alongside most layers (except for view maybe) . I think the next step will be tight binding of components and corresponding microservices.
Didn't it take us years to stop writing javascript and html embedded? Is it just me or are we going back where we started? It's all a mix now!
undefined
webdev
why would you do that
javascript
angularjs