Sails model binder for AngularJS (based on the idea of angular-sails-bind by Diego Pamio - https://github.com/diegopamio)
- One line binding
- Configurable binding
- Extendable model "class"
Not yet
anSailsModel.bind(<model name>, <scope>, <filter>, <options>);- Type: string or array
- Optional: no
If model name is a string, then anSailsModel will bind model data to a scope variable with the same name. If model name is an array, the first element is the model you wish to bind, and the second element is the scope variable name you wish to bind to.
For example:
anSailsModel.bind('user', $scope); // Binding user model to $scope.user
anSailsModel.bind(['user', 'users'], $scope); // Binding user model to $scope.users- Type: object
- Optional: No
The scope to bind models to.
- Type: object
- Default: {}
- Optional: yes
Model query filters. Syntax is the same with the backend syntax.
- Type: object
- Default: {}
- Optional: yes
Binding config options.
- Type: function
- Default: an.angular.sails.Model
- Optional: yes
Constructor of the model "class" you'd like to use at binding. Useful if you extend the base "class".
- Type: string
- Default: perModel
- Optional: yes
Valid values are: global, perModel
Determines if the anSailsModel events should be global or per model based.
- Type: boolean
- Default: false
- Optional: yes
Determines if the model(s) should or shouldn't automatically persist their value(s) on change.
- Type: boolean
- Default: false
- Optional: yes
Determines if the model(s) should or shouldn't listen to the backend for any changes.
- Type: function
- Default: an.sails.model.Restful
- Optional: yes
Valid values are: an.sails.model.Restful, an.sails.model.Shortcut
Determines the transport method used by the model(s). This is a global option for all binds!
- sailsModelSaveSucceed
- sailsModelSaveFailed
- sailsModelDeleteSucceed
- sailsModelDeleteFailed
$ node grunt
- Unit tests
- Profiling/optimizations
- Bower package
The MIT License (MIT)
Copyright © 2013 Agoston Nagy
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
