Location: app/assets/javascripts/components
.
A component shouldn't modify any data or DOM that's out of its scope. All communication should go via bindings. One-way binding should be preferred over two-way binding.
Set controllerAs: "vm"
.
templateUrl:
should be preferred over template:
but at the moment it's impossible to test that component's HTML is generated correctly if templateUrl:
is used. So temporarily template:
should be used instead of templateUrl:
.
Component for a button element.
%miq-button{:name => t = _('Cancel'),
:title => t,
:alt => t,
:enabled => "true",
'on-click' => "cancelClicked()"}
%miq-button{:name => t = _('Validate'),
:enabledTitle => validate_title_on,
:disabledTitle => validate_title_off,
:enabled => "true",
'on-click' => "cancelClicked(),
:primary => "true"}
It consists of:
name
(String) sets text shown in the button.enabled
(expression) sets button to enabled or disabled.enabledTitle
(String, optional) used if button has different title/alt for enabled and disabled state. Sets title/alt for enabled button. IfenabledTitle
is setdisabledTitle
should be set as well.disabledTitle
(String, optional) used if button has different title/alt for enabled and disabled state. Sets title/alt for disabled button. IfdisabledTitle
is setenabledTitle
should be set as well.primary
(expression, optional) True if button has classbtn-primary
otherwise it will have classbtn-default
.onClick
(function) is a callback to be called when button is clicked.
If title
/alt
are the same for both states, title
and alt
should be set as attributes of the button.