Materialize data entry screens
Issue #590
wontfix
proposal on possible strategy….
Comments (4)
-
reporter -
reporter PROS and CONS
PRO:
declarative,
reduces boilerplate coding
full-featured ie includes err handling aria etc etc
consistent
CONS
more to learn
harder to customise by site
less intuitive for those already familiar with angularjs / html
@ghachey for your information really, if you are interested in pursuing I can work one small page on this technique.
All the code is in Softwords.Web which is open source.
-
reporter - marked as minor
proposal on possible strategy….
-
- changed status to wontfix
No work on this until a migration to latest Angular
- Log in to comment
Material Deisgn in data entry forms
One characteristic of Mvc is the 'Html helpers' that are used to generate ui for a field in a table, based on the metadata in that fields definition. That is, the attributes of the field such as [Maxlength] , [Required] can generate the max-length and required attributes on the inut that is generated for the field.
In Mvc, these helpers are written as extensions of the Html object exposed in the cshtml page - you use them like this:
Here m is the "model" in the page, the expressions returns a single property of that model.
In Mvc usage, this model is an instance of a table value - so these helpers insert the value of the preropty into the generated control.
To make helpers that work with angular we need:
-- the model to represent a type, not an instance. No instance of the type is supplied when the page is requested - the instance data is inserted at the client.
-- the markup generated by the helper is angularjs markup; that is, where an Mvc helper will write
value= required max-length="50"
a helper targeting angular js need to write
ng-model="schNo" ng-maxlength="50" ng-required="true"
Further, if targeting angularjs-material, the helper needs to respect the sophisticated css that governs the layout and animation in angularjs-material.
Softwords.Web includes helpers in this design.
To use these in a data entry cshtml page:
Expanding the ng helpers against sEmail as defined above, gives this:
points to note:
-- [EmailAddress] attribute creates email markup
-- errors are handled
-- aria markup for hearing impaired generated from Display attribute
Example Helpers
ngBindTo
-- this is the simplest helper that is used inside an input on the page:
<input @Html.ngBindTo(m=m>pxEmail) />
ngInputFor
-- this generates the appropriate input element:
ngInputFor can take an extra configuration object same as built in InputFor
mdContainerFor
-- This generates the input within a container, including the error messages - a simple default
expanded: