I'm working on an app that has a large form with a large config object, with 25+ properties and several nested objects. I'm trying to create a directive/component that populates several of these properties, and I was wondering if it's more efficient in terms of $$watchers to pass in the entire form/configuration object or those properties individually as bindings. In other words:
<my-directive config="config"></my-directive>
versus
<my-directive
prop-one="config.prop1"
prop-two="config.prop2"
prop-three="config.prop3">
</my-directive>
Thanks!
This is what i think you should do:
<my-directive config="config"></my-directive>
and in the directive template you should set two-way binding with ng-module or just one way binding.
The purpose of the directive is to unite the logic to one place with is gui and then to expose the result has a config object or using a callback function.
Hope it helps.
Keep in mind that you can't two-way bind an object you can only bind a property.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.