Javascriptservices: Please update Angular template to Angular CLI 6

Created on 4 May 2018  路  12Comments  路  Source: aspnet/JavaScriptServices

Since Angular 6 and Angular CLI 6 has been released it would be great if you could please update this template to Angular CLI 6.

Most helpful comment

@naveedahmed1 SSR by default? Not sure I agree. This isn't exactly a trivial feature that 'just works'. One should probably understand the implications before turning this on, even current docs have big warning blobs of text.

All 12 comments

There is an alternative solution for UseAngularCliServer or UseProxyToSpaDevelopmentServer (template net core 2.0) to start with angular.json (old ".angular-cli")?. WDS does not refresh change in template or logic (ts).

@dballemo can you elaborate more?

After updating package.json with Angular 6.0.0 and migrating from ".angular-cli.json" to "angular.json", the template starts with UseProxyToSpaDevelopmentServer but the changes in html and ts are not refresh (Wds) changes in browser Chrome . Requires start project again.

@SteveSandersonMS since https://github.com/angular/angular-cli/issues/8616 should be merged soon it would be better that this update has SSR enabled by default.

@naveedahmed1 SSR by default? Not sure I agree. This isn't exactly a trivial feature that 'just works'. One should probably understand the implications before turning this on, even current docs have big warning blobs of text.

Please don't enable SSR by default. For web apps behind firewalls, SSR is not essential.

Just for anyone who's interested, we're not planning to enable SSR by default. It's not beneficial in a lot of cases, and adds complexity. So we intend to keep it an optional feature with docs about how to enable it and work within its constraints.

Ok makes sense. Can you please update the docs to show how to return proper status code such as 404 in SSR section?

Can you please also share the download link for the pre release updated template once it's completed?

Thank you for the awesome work 馃憤

Does anyone know why JavascriptServices doesn't work with angular6? Is there a work around to get this working?

We're working on the update at https://github.com/aspnet/templating/pull/515

To get a clean project with Angular 6 :

  • Wipe out the contents of ClientApp that this template creates - or if you're planning on referring to the sample code just rename it or put it elsewhere
  • Run ng new with the options you want
  • Copy into ClientApp the files created by ng new
  • Note ng new will create a subdirectory. Copy everything a level up so ClientApp has the same structure as before (apart from the changes like angular.json).

The rest of the template will work just fine, but this will get you up and running with a clean slate of the latest ng bits.

simeyla did you get the Publish to work after doing that? Publish doesn't work for me when you do that. To test, right-click on your project, Properties -> Debug and change your ASPNETCORE_ENVIRONMENT variable to Production then run. Site should fail with:
"Error.
An error occurred while processing your request.
Request ID: 0HLF7GTE6V8F0:00000001

Development Mode
Swapping to Development environment will display more detailed information about the error that occurred.

Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application."

In the Output window it shows "The SPA default page middleware could not return the default page '/index.html' because it was not found, and no other middleware handled the request.
Your application is running in Production mode, so make sure it has been published, or that you have built your SPA manually. Alternatively you may wish to switch to the Development environment."

Not sure how to fix this.

Was this page helpful?
0 / 5 - 0 ratings