Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Dave 14 posts 35 karma points
    Jan 22, 2014 @ 13:38
    Dave
    0

    Routes and parameters using custom tree and MVC not Angular

    I have a situation where I have decided to leverage MVC contollers and views instead of Angular as I have a lot of existing code that I need to port in to an Umbraco solution. I have had some succsess doing this by mapping the routes and forcing it to use a MCV controller which renders a MVC view - everything is working well, the create and edit views hit the controller and render the ASP.NEt MVC view! Happy days, apart from one issue...

    Take a look at the following route mapping and you will see that I am looking for edit.html/{id} - however the ID is never returned to my controller - I susspect it is because the actual URL hit does not contain the id param...can anybody confirm this and is so offer a way that I can ensure that I can read the ID on my controller (and this is a MVC controller not an Angular controller).

            routes.MapRoute(
                name: "TestEdit",
                url: "App_Plugins/test/backoffice/testitem/edit.html/{id}",
                defaults: new { controller = "test", action = "Edit", id = ""}
                );
  • Per Ploug 865 posts 3491 karma points MVP admin
    Jan 22, 2014 @ 14:49
    Per Ploug
    0

    I think this will end in tears Dave :)

    Angular uses templates that are rendered in the browser, and doesnt support serverside processing, you can only return a single instance of a template, not different templates based on different IDs.

    This is because the templating and logic happens in the browser, which means we can cache things quite effectively and make the application really fast. By trying to cram server-rendered html into the angular templating system you are trying to break a fundamental thing in angular.

    The alternatives are to load in the views through the legacy iframe based approach or look into converting your views into angular that then load data from your mvc controllers as mvc - depending on project size, time available etc, I would recommend that you do the angular conversion.

  • Dave 14 posts 35 karma points
    Jan 22, 2014 @ 15:54
    Dave
    0

    I will ditch for version 6 :) There is a lack of support and documentation for 7 and it means learning a lot of new things. Deadlines wont allow :) 

  • Dave 14 posts 35 karma points
    Jan 22, 2014 @ 15:59
    Dave
    2

    As an aside, personal opnion here! but Umbraco is an ASP.NET MVC CMS....whats with the use of a Javascript MVC framework!? The application is sat smack on top of the .NET stack....its a really strange direction to take.

  • Andreas Pfanner 196 posts 314 karma points
    Apr 30, 2014 @ 16:49
    Andreas Pfanner
    2

    Hi,

    I would like to revive this discussion:

    @Per / Umbraco HQ: What is the main reason for using Angular instead of ASP.NET MVC for doing the main backend templating etc. What are the advantages of NOT using MVC Views (.cshtml, and all the helpers available there), but plain HTML/JS views with Angular? Is it just for performance? How are your experiences with that application model so far (maintenance, extensibility, clearness..)?

    Best Regards Andreas

  • Edwin van Koppen 156 posts 270 karma points
    Sep 03, 2014 @ 09:59
    Edwin van Koppen
    0

    I'm also curious about that reason :)

  • Angelo 111 posts 260 karma points
    Nov 19, 2014 @ 11:17
    Angelo
    0

    i work with telerik also ... and they have  amazing helpers that i also extended  .. with this new aproach i had to reorganize all the code .. and throw away hours of really nice MVC helpers ...that gives you all with one line of code

    ... with angular ... lets start building the wheel again ... :( 

    sorry its just an humble opinion ...

     

    AS

  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Nov 28, 2014 @ 12:44
    Dave Woestenborghs
    0

    Hi Dave,

    You can still use your MVC views but then you need to change the way you render the tree for your custom section. I guess you now inherit your tree from a class Umbraco.Web.Trees.TreeController. This is the new tree controller introduced in v7 and is meant to be used with angular.

    You can still you use the v6 style trees. But than you need to inherit your custom tree class from umbraco.cms.presentation.Trees.BaseTree

    You can find a lot of examples online on how to create a custom section that way for example this blogpost by Tim Geyssens : http://www.nibble.be/?p=250

    Dave

  • Angelo 111 posts 260 karma points
    Nov 28, 2014 @ 16:51
    Angelo
    0

    Thank you for your post ... but that one i already know how to do it and that is a view ... what about a plugin ? or a datatype ? i searched and searched ...could find any documentation on that for U7 ...do you know how to do it or any place where i can get that ? 

    thank you 

    AS

     

  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Dec 01, 2014 @ 15:18
    Dave Woestenborghs
    1

    What do you mean with a Plugin ?

    Property editors should be created using angular in V7. See linsk below for documentation and tutorials

    http://our.umbraco.org/documentation/Extending-Umbraco/Property-Editors/property-editors-v7

    http://umbraco.github.io/Belle/#/tutorials/CreatingAPropertyEditor

    Dave

  • Ayo Adesina 430 posts 1023 karma points
    Aug 03, 2017 @ 05:51
    Ayo Adesina
    0

    2017 and this I am having this exact discuission in my head. I want to use MVC and it seems like you can, but with a bit of extra effort.

    Even though MVC is my strongest skill set I think its about time to bite the bullet and go agualr.

    Wish me luck!

Please Sign in or register to post replies

Write your reply to:

Draft