문제

The tutorials and example I've seen are all single page application.

Can anyone give an idea or point to a resource showing how a multiple page app can be developed with CanJS?

도움이 되었습니까?

해결책

You should be able to create a new page in whatever app framework you are using or even just static pages, and then hookup your new control and view to any element on that new page.

You want to have a separate control for each module, so you might have separate controls even on a single page if you have, for example, a filterable dropdown list, a todo list, and a login. So, in your canjs directory for your app you will have separate sub-directories for each module which will contain your control, view/s, model/s, and observe/s and unit tests. This makes them re-usable, easier to test, and since they are modular if one part of your app breaks it won't take down all functionality. Once you get the hang of that incorporate AMD style loading of your assets with stealJS which is made by Bitovi - the CanJS creators. https://github.com/bitovi/steal

If you want to manipulate the location.hash without actually changing pages or manaage browser history and client state you should check out can.route: http://canjs.com/docs/can.route.html

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top