none
ASP NET Core MVC API with Angular app not updating with my changes (beginner) RRS feed

  • Question

  • Hi there! I'm an experienced C# developer but I'm really struggling to learn Angular4 and I'd really appreciate some help, please.

    I'm using Visual Studio 2017 Community Edition to make an ASP NET Core MVC API application with an Angular front-end, starting from the out-of-the-box template that has a HomeComponent, CounterComponent and FetchDataComponent. I'm afraid I have broken something and I don't know how to fix it.

    My trouble is that, when I debug the application from Visual Studio using Chrome browser, Angular seems to be ignoring any changes that I made to my source files - it's as if it's serving up the original template application instead of the one I edited. For example:

    I changed "Hello, World!" to "Hello, Cruel World!" in my home.component.html and debug, but the change isn't reflected.

    So then I tried changing app.routing.ts so that it should load a completely different component when the app is started. I changed:

        { path: '', component: HomeComponent }

    To

        { path: '', component: CounterComponent }

    But when I debug, it still loads the HomeComponent. Next I renamed HomeComponent to HoomeCompoonent so it should be 100% impossible for the app to work now. It should be totally broken but it isn't. It stubbornly loads the HomeComponent exactly the same as how it looked before I started. It's as if nothing I do makes a difference.

    I have deleted the bin, and obj folders before rebuilding, in case Visual Studio was caching a previous version of the app, but it still serves the original Angular site instead of my updated one.

    I have a suspicion that it's something to do with wwwroot. I guess maybe Visual Studio is supposed to update some files in wwwroot when the Angular app is changed, and maybe it isn't doing that?

    I decided to do a search for the text "Hello, World" in my wwwroot folder and found it in a very long, complex file called main-client.js in wwwroot/dist I thought this could be the place where the old version is being cached. I deleted the file, and managed to break the site. I got an error in the Chrome developer window that it couldn't find the file.

    Do I have to learn to edit the main-client.js file, or is that file supposed to be auto-generated by Visual Studio? How do I make the file update when I change my Angular components? Or am I on the wrong track completely?

    Appreciate any advice. Thanks in advance!

    • Moved by 宝宝徐 Tuesday, August 29, 2017 6:09 AM
    Friday, August 25, 2017 9:25 AM

All replies

  • Hi Benjamin,

    Thanks for you posting.

    But ASP.NET has its own forum where is a place to post the related issues, and you will get more professional answer for your issue from the support engineer there.

    https://forums.asp.net/

    Thanks for your understanding.

    Have a good day:)

      

    Best regards, 

    Fletcher  


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.



    • Edited by Fletch Zhou Tuesday, August 29, 2017 5:56 AM
    Monday, August 28, 2017 2:30 AM