-
Notifications
You must be signed in to change notification settings - Fork 117
sm-radio-button design questions #5
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
I don't really like requiring the radio-group directive, because this is very different from what HTML does. That said, there are advantages in an angular context: only instantiating one ngModelController, rather than having N different ones, with only the last-registered one associated with the form, all fighting each other. So I'm generally ok with this, but it needs to be made clear that this is the approach taken. Putting methods on prototype is fine. You need to be a bit careful with it though, because it means you no longer support unbound execution of functions, which can have a performance cost if you need to use it in a $watch listener or similar. It's fine to do this, just be careful and try to avoid relying on support for unbound execution. I would be careful with helper services. If the plan is to split this project into N different modules it makes some sense, but otherwise I'd rather avoid polluting the injector. |
Yes, I planned to make each directive to be in its module. Those services look nice and make code DRY having everything in one place which makes changes much easier. |
realistically, having each directive in its own module is going to make using the project very difficult and cumbersome, for relatively little benefit. Better to let people customize what they want to include in their own build, imo. Otherwise, try to group different kinds of directives into specific categories, like "forms", "mobile", etc, and make modules based on those categories so it's less crazy. |
well, the idea I have is to have each directive in its module which could reflect what type is this element, according to grouping in Semantic-UI. So that 'sm-button', for instance in 'semantic.ui.elements.button' module where elements is a type. Though, when dist is built it would be just one 'semantic.ui.angular' module. So that in the future we could consider custom builds where user can choose which components to include in ''semantic.ui.angular'. What do you think ? That is how bootstrap-ui and angular-material are organized. |
Go for it |
hi, @caitp I am trying to figure out when I should implement and use $render over $formatters in ngModelController. I am pretty sure I know what are those but still do not see clearly what I would use in which case. Could you provide some explanation, please ? |
$formatters transforms model values into view values, $parsers transforms view values into model values, $validators and $asyncValidators perform validation, and $render applies the view value to the control |
If the outcome of this discussion is to set precedent for organizing modules and how the modules are named, I'd like to throw in my $.02.
|
@hackedbychinese I think your comment should be put under #8 (About this project). |
Closed by #10 |
I am planning to create a radio button directive (sm-radio-button) which should probably work in conjunction with sm-radio-group directive which manages a set of sm-radio-button directive. This design is borrowed from angular-material. So, in generic case it should look like:
I have a couple of questions:
Angular-design has a set of custom services such as '$mdConstant', '$mdUtil'. Should I consider analogues services as well since they look like good ideas.
Is design using controller's prototype to set helper methods considered suitable for us as well ?
What else should I consider ?
@caitp please take a look once you have a chance.
The text was updated successfully, but these errors were encountered: