JavaScriptServices icon indicating copy to clipboard operation
JavaScriptServices copied to clipboard

Please update Angular template to Angular CLI 6

Open naveedahmed1 opened this issue 8 years ago • 12 comments

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.

naveedahmed1 avatar May 04 '18 15:05 naveedahmed1

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 avatar May 06 '18 06:05 dballemo

@dballemo can you elaborate more?

alx-andru avatar May 06 '18 18:05 alx-andru

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.

dballemo avatar May 06 '18 18:05 dballemo

@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 avatar May 06 '18 19:05 naveedahmed1

@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.

tomgruszowski avatar May 06 '18 23:05 tomgruszowski

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

changhuixu avatar May 08 '18 16:05 changhuixu

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.

SteveSandersonMS avatar May 08 '18 16:05 SteveSandersonMS

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 👍

naveedahmed1 avatar May 08 '18 16:05 naveedahmed1

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

djarekg avatar May 09 '18 03:05 djarekg

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

SteveSandersonMS avatar May 10 '18 17:05 SteveSandersonMS

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 avatar Jun 25 '18 20:06 simeyla

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.

anthwri avatar Jul 11 '18 23:07 anthwri