I’m quite new to Aurelia. I have managed to get Aurelia up and running within an ASP.NET MVC application, and now I want to fetch an Aurelia element view using an ASP.NET MVC action. I have seen some examples using either useView, getViewStrategy or ViewLocator but even though the examples mention ASP.NET MVC or Razor, they all appear to use static HTML.
My findings:
useView
@useView('/Issue/EditIssueHtml')
export class EditIssue {
Apperently useView only support static HTML: Unhandled rejection Error: Load timeout for modules: template-registry-entry!/Issue/EditIssueHtml,text!/Issue/EditIssueHtml
getViewStrategy
export class EditIssue {
getViewStrategy() {
return '/Issue/EditIssueHtml';
}
}
The method only works for the application root (it is never called for elements). However, using it with the application root and an ASP.NET MVC action throws the same error as when using useView suggesting that only static HTML is supported.
ViewLocator
ViewLocator.prototype.convertOriginToViewUrl = (origin: Origin) => {
var moduleId: string = origin.moduleId;
var name = moduleId.split('/')[moduleId.split('/').length - 1].replace('ViewModel', 'View').replace('.js', '').replace('.ts', '');
console.log('ViewLocator: ' + name);
if (name !== 'edit-issue') {
return `${name}.html`;
}
return "/Issue/EditIssueHtml";
}
Same error as with useView.
I found a question at Aurelia server side views: Adding auth header to http download request of view/viewmodel where the questioner claims to have created a working solution based on the Aurelia documentation at http://aurelia.io/hub.html#/doc/article/aurelia/framework/latest/app-configuration-and-startup/9, but the documentation does not mention anything about server side views.
Have I missed something or does Aurelia not support server side views?