Model structure in Durandal resembling "classes"

77 views Asked by At

I'm fairly new to Durandal, Knockout and Requirejs, so I wanted to ask some opinions whether my structure makes sense or not:

I've been planning to create models for my data objects, like classes in class-based languages. therefore i would be creating a folder models in which I'd define modules like student (transient, holds one students data) and students (singleton, holding array of student objects and functions for adding, removing, etc).

These modules I would then require in my ViewModels (e.g. admin/students for the administration area, user/student where the data for one student is loaded... etc...)

Does this make sense or would it be better to just put everything into one module and define students and student in every viewModel? I'm a little lost on how to leverage reusable code here.

0

There are 0 answers