-
-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request: add a viewUrl
property to the routes
#590
Comments
Note: I think we already support this 😃 I forgot. Try setting the moduleId property of the route config to an html file path. Looking in the templating-router's route-loader, I see special code there intended to handle that scenario. @gordon-matt Give it a try and let me know if it's as you would expect. |
@EisenbergEffect When you say "Set it to an .html file path", I see 2 issues:
|
In that case, you probably want to build a custom RouteLoader. It's designed to be pluggable. You can start with our TemplatingRouteLoader and then modify for your needs. I don't think we can implement this in a backend-agnostic way. It sounds like you've got a very particular setup. |
Having a
This would work perfectly as far as I can tell. Am I missing something? |
Looking through the code, it looks like you can already tell it a view to use
So you could maybe just add a The properties are not in the documentation. |
@stsje Thanks, I will give that a try a little later today and report back here. |
Well, I've tried the Firstly, I want to remind you that my
Next, I had to change the
So when I browse to the contact manager, it tries to load the contact list from |
So it's not just the router you want to change the view convention for, it's every component in your project? That's something the |
Yes perhaps I was not clear.. I am using ASP .NET Core 2.0 and want to use Razor views (.cshtml) to output the HTML. I already have a working project which you can find here: https://github.com/gordon-matt/aurelia-razor-netcore2-skeleton. You can take a look at my main.js in there and see what I am doing in the |
this should be a 'plugin' |
@Alexander-Taran It appears the option is already there (there's a |
nav:true is a true mystery (-: |
@gordon-matt I don't know if anything changed or I'm just not using everything you are, but the @stsje Thanks for looking into this, you saved my day! 👍 |
@gordon-matt commented on Sun Apr 22 2018
As discussed in an email with @EisenbergEffect, could we please have a viewUrl property in the routes? At the moment it appears that Aurelia is simply taking the moduleId and appending a .js extension to find the model and an .html extension to find the view.
In order to use Razor routes, I make use of
ViewLocator.prototype.convertOriginToViewUrl
as follows:If you look at it carefully, you will see it’s not quite perfect. I would actually prefer to not have to do this at all.. we could have Aurelia still look for .html files by default, but if there’s a viewUrl property in the route definition, then use that instead.. That way, modules that are not being served by ASP .NET controllers and have actual HTML files (for example: aurelia-kendo-bridge and others) won’t be affected... and it will allow me to have the .js file location decoupled from the .html file location, so I can put them wherever I want and additionally, I can then use embedded javascript as well. I did that with Durandal by passing the embedded script path to the RequireJS config.. but I currently don’t see a way of doing this in Aurelia.. and I absolutely need embedded js files in my architecture in some cases.
@davismj commented on Mon Apr 23 2018
@EisenbergEffect can you move this to router please?
@stsje commented on Mon Apr 23 2018
I'm not sure a new
viewUrl
property will be a good name when/if the newcomponent
property is implemented. aurelia/templating-router#75At least consider the above PR before implementing
viewUrl
:)!The text was updated successfully, but these errors were encountered: