AmpersandJS / ampersandjs.com

The documentation site for ampersand.js
http://ampersandjs.com
MIT License
51 stars 40 forks source link

Critical: view.props is missing in docs #81

Open jrmyio opened 10 years ago

jrmyio commented 10 years ago

Wow, i was completely unaware views can hold props/derived too. That changes the way you build your models a lot!

I think it should be added to the docs asap!

(I'm unaware if "session" is supported too)

wraithgar commented 10 years ago

I don't think the props in view are technically supported. There are things in the view that needed to be stateful, so view extends state and has custom types for element and collection.

What kind of other properties are you finding that you need to store in the view?

legastero commented 10 years ago

@wraithgar They're intentionally supported. See the form views for good examples of extra view state. Basically any type of widget view will want these.

I vaguely recall convincing Henrik that this sort of behaviour was needed so that I could publish standalone Ampersand models (say a chat message model), and use (derived) view properties to adapt those models to the view's needs.

HenrikJoreteg commented 10 years ago

Yup views are based on state too. Good point on the docs. Props, session and derived all work. In fact that's how it knows when rendered or not. It has a prop for el.