{"action":"created","issue":{"url":"https://api.github.com/repos/aurelia/router/issues/131","labels_url":"https://api.github.com/repos/aurelia/router/issues/131/labels{/name}","comments_url":"https://api.github.com/repos/aurelia/router/issues/131/comments","events_url":"https://api.github.com/repos/aurelia/router/issues/131/events","html_url":"https://github.com/aurelia/router/issues/131","id":90080029,"number":131,"title":"Consider adding a templateUrl property to the router configuration to override the convention","user":{"login":"petermorlion","id":3483719,"avatar_url":"https://avatars.githubusercontent.com/u/3483719?v=3","gravatar_id":"","url":"https://api.github.com/users/petermorlion","html_url":"https://github.com/petermorlion","followers_url":"https://api.github.com/users/petermorlion/followers","following_url":"https://api.github.com/users/petermorlion/following{/other_user}","gists_url":"https://api.github.com/users/petermorlion/gists{/gist_id}","starred_url":"https://api.github.com/users/petermorlion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petermorlion/subscriptions","organizations_url":"https://api.github.com/users/petermorlion/orgs","repos_url":"https://api.github.com/users/petermorlion/repos","events_url":"https://api.github.com/users/petermorlion/events{/privacy}","received_events_url":"https://api.github.com/users/petermorlion/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aurelia/router/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-22T12:01:40Z","updated_at":"2015-06-24T12:38:29Z","closed_at":"2015-06-22T13:17:38Z","body":"I know you can provide your own convention via `ConventionalViewStrategy.convertModuleIdToViewUrl`, but would it not be interesting to be able to override the view url for specific views?\r\n\r\nSimilar to the `templateUrl` property in Angular, where you can do:\r\n\r\n    $routeProvider.\r\n      when('/phones', {\r\n        templateUrl: 'partials/phone-list.html',\r\n        controller: 'PhoneListCtrl'\r\n      }).\r\n      when('/phones/:phoneId', {\r\n        templateUrl: 'partials/phone-detail.html',\r\n        controller: 'PhoneDetailCtrl'\r\n      }).\r\n      otherwise({\r\n        redirectTo: '/phones'\r\n      });\r\n\r\nIn Aurelia, I would like to do something like:\r\n\r\n    router.configure(config => {\r\n            config.map([\r\n              { route: ['','page1'],  moduleId: './page1' },\r\n              { route: ['page2'],  moduleId: './page2', templateUrl: './api/page2 }\r\n            ]);\r\n        });\r\n\r\nPage1 would be found at http://www.example.com/page1.html, but page2 at http://www.example.com/api/page2\r\n\r\nIn my case, when using Aurelia with ASP.NET, I could call a standard Controller/View combination and have some rendering already done at the server-side.\r\n\r\nMy current alternative is to have something like this in the convention function:\r\n\r\n    ConventionalViewStrategy.convertModuleIdToViewUrl = function(moduleId){\r\n        if (moduleId === 'page2') {\r\n            return 'api/page2';\r\n        }  \r\n\r\n           return moduleId + '.html';\r\n    }"},"comment":{"url":"https://api.github.com/repos/aurelia/router/issues/comments/114852083","html_url":"https://github.com/aurelia/router/issues/131#issuecomment-114852083","issue_url":"https://api.github.com/repos/aurelia/router/issues/131","id":114852083,"user":{"login":"petermorlion","id":3483719,"avatar_url":"https://avatars.githubusercontent.com/u/3483719?v=3","gravatar_id":"","url":"https://api.github.com/users/petermorlion","html_url":"https://github.com/petermorlion","followers_url":"https://api.github.com/users/petermorlion/followers","following_url":"https://api.github.com/users/petermorlion/following{/other_user}","gists_url":"https://api.github.com/users/petermorlion/gists{/gist_id}","starred_url":"https://api.github.com/users/petermorlion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petermorlion/subscriptions","organizations_url":"https://api.github.com/users/petermorlion/orgs","repos_url":"https://api.github.com/users/petermorlion/repos","events_url":"https://api.github.com/users/petermorlion/events{/privacy}","received_events_url":"https://api.github.com/users/petermorlion/received_events","type":"User","site_admin":false},"created_at":"2015-06-24T12:38:29Z","updated_at":"2015-06-24T12:38:29Z","body":"I'm not sure I understand exactly where I find this property.\r\n\r\nI have found the possibility to add a `getViewStrategy` function to the viewmodel. But I find that is coupling my VM to much to my View. Plus it puts the mapping of a route to its view URL in multiple locations in my app:\r\n\r\n - In app.js where I configure my router\r\n - In my viewmodels where I want to override the default behavior\r\n\r\nHaving a viewStrategy on my route config object would be nice, but I can't get it to work. I've tried this for example:\r\n\r\n    export class App {\r\n        configureRouter(config, router){\r\n        config.title = 'Aurelia';\r\n        config.map([\r\n          { route: ['','welcome'],  moduleId: './welcome',      nav: true, title:'Welcome' },\r\n      \r\n          { route: 'flickr',        \r\n            moduleId: './flickr',       \r\n            nav: true, title:'Flickr',      \r\n            viewStrategy:'./new-flickr.html'},\r\n        \r\n          { route: 'child-router',  moduleId: './child-router', nav: true, title:'Child Router' }\r\n        ]);\r\n    \r\n        this.router = router;   \r\n      }\r\n    }\r\n\r\nHere, I would want Aurelia to use `./new-flickr.html` as the template for the Flickr page.\r\n\r\nSo I'm guessing I'm looking in the wrong place?"}}