Sharing Top Content from the Angular-sphere.

Component-Relative Paths in Angular 2

  • We should never see [in the DevTools console] a 404 loading error for this component.
  • So the above component – without any url path information – must be stored in the application root in order to avoid 404 errors.
  • If path to the component HTML or CSS file is not valid, the EASY workaround is to add absolute paths to the URLs.
  • This practice of using external files is especially important when your HTML or CSS is non-trivial.
  • Using absolute paths in our URLs for component HTML or CSS is a horrible idea and band-aid solution.

Read the full article, click here.

@PascalPrecht: “Yesterday we published an article about relative paths for Angular 2 component assets. You can read it right here ~”

Creating components in Angular 2 is awesome in so many ways. Developers should be careful, however, when using external component HTML and CSS files. Component-relative paths are not immediately intuitive. But with a brief review of the relative issues and constraints, developers can more easily create maintainable, reusable, portable components.

Component-Relative Paths in Angular 2