I stumbled upon an informative article detailing the integration of Razor partials (cshtml) with aurelia. Despite my efforts, I encountered difficulty in getting the code to execute properly and was informed by Rob Eisenberg's comment that
ConventionalViewStrategy.convertModuleIdToViewUrl
was no longer supported. He suggested using the ViewLocator service instead. Although I delved into the GitHub project, I couldn't find direct relevance to integrating with MVC5 and Razor Partials, leaving me perplexed.
Below is the sample main.js file that I hoped to modify to route aurelia to Home/Index/Index.cshtml rather than index.html
import {LogManager} from "aurelia-framework";
import {ConsoleAppender} from "aurelia-logging-console";
import {ConventionalViewStrategy} from "aurelia-framework";
LogManager.addAppender(new ConsoleAppender());
LogManager.setLevel(LogManager.logLevel.debug);
export function configure(aurelia) {
aurelia.use
.standardConfiguration()
.developmentLogging();
ConventionalViewStrategy.convertModuleIdToViewUrl = function(moduleId){
var moduleName = moduleId.replace("Scripts/", "");
return `./Templates/${moduleName}`;
}
aurelia.start().then(a => a.setRoot("./Scripts/index", document.body));
}
Is there anyone who can guide me on setting up aurelia in an MVC5 project to utilize .cshtml instead of .html templates? I am utilizing Typescript and VS2015.