{"action":"created","issue":{"url":"https://api.github.com/repos/canjs/canjs/issues/314","labels_url":"https://api.github.com/repos/canjs/canjs/issues/314/labels{/name}","comments_url":"https://api.github.com/repos/canjs/canjs/issues/314/comments","events_url":"https://api.github.com/repos/canjs/canjs/issues/314/events","html_url":"https://github.com/canjs/canjs/issues/314","id":12004834,"number":314,"title":"Make can.view not make an AJAX request when an id lookup fails","user":{"login":"ccummings","id":464282,"avatar_url":"https://avatars.githubusercontent.com/u/464282?v=3","gravatar_id":"","url":"https://api.github.com/users/ccummings","html_url":"https://github.com/ccummings","followers_url":"https://api.github.com/users/ccummings/followers","following_url":"https://api.github.com/users/ccummings/following{/other_user}","gists_url":"https://api.github.com/users/ccummings/gists{/gist_id}","starred_url":"https://api.github.com/users/ccummings/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ccummings/subscriptions","organizations_url":"https://api.github.com/users/ccummings/orgs","repos_url":"https://api.github.com/users/ccummings/repos","events_url":"https://api.github.com/users/ccummings/events{/privacy}","received_events_url":"https://api.github.com/users/ccummings/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/canjs/canjs/labels/Feature","name":"Feature","color":"02d7e1"},{"url":"https://api.github.com/repos/canjs/canjs/labels/Needs%20a%20hero","name":"Needs a hero","color":"000000"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2013-03-14T03:52:05Z","updated_at":"2015-11-13T05:16:16Z","closed_at":"2015-11-13T05:16:16Z","body":"There should be a way to tell can.view to stop if it doesn't find an element with the given id. \r\n\r\nRight now can.view will try first to lookup a template by id and fallback to making an AJAX request. https://github.com/bitovi/canjs/blob/master/view/view.js#L471\r\n\r\nI have two ideas for solving this:\r\n\r\ncan.view takes an Object with an id or url key (it can also take a String which will do an id lookup then Ajax)\r\n\r\n```js\r\ncan.view({id: 'tmpl'}) //-> id lookup, no Ajax request\r\ncan.view({url: 'mytmpl/tmpl.mustache'}) //-> Ajax request, no id lookup\r\ncan.view('tmpl') //-> id lookup then Ajax request\r\n```\r\n\r\nAnother way to know is to assume a `#` at the beginning of the URL means id lookup only. We already assume as much in the [code](https://github.com/bitovi/canjs/blob/master/view/view.js#L486), but still fallback to an Ajax request. \r\n\r\n```js\r\ncan.view('#tmpl', {}) //-> id lookup only\r\ncan.view('tmpl', {}) //-> id lookup then Ajax request\r\n```"},"comment":{"url":"https://api.github.com/repos/canjs/canjs/issues/comments/156325711","html_url":"https://github.com/canjs/canjs/issues/314#issuecomment-156325711","issue_url":"https://api.github.com/repos/canjs/canjs/issues/314","id":156325711,"user":{"login":"justinbmeyer","id":78602,"avatar_url":"https://avatars.githubusercontent.com/u/78602?v=3","gravatar_id":"","url":"https://api.github.com/users/justinbmeyer","html_url":"https://github.com/justinbmeyer","followers_url":"https://api.github.com/users/justinbmeyer/followers","following_url":"https://api.github.com/users/justinbmeyer/following{/other_user}","gists_url":"https://api.github.com/users/justinbmeyer/gists{/gist_id}","starred_url":"https://api.github.com/users/justinbmeyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justinbmeyer/subscriptions","organizations_url":"https://api.github.com/users/justinbmeyer/orgs","repos_url":"https://api.github.com/users/justinbmeyer/repos","events_url":"https://api.github.com/users/justinbmeyer/events{/privacy}","received_events_url":"https://api.github.com/users/justinbmeyer/received_events","type":"User","site_admin":false},"created_at":"2015-11-13T05:16:16Z","updated_at":"2015-11-13T05:16:16Z","body":"I think this is sorta dead because of the ubiquity of using a loader for templates.  Closing unless there's a hero to do it."}}