This repository has been archived by the owner on Jan 22, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
refactor(radio, select): change model in view types #48
Open
sciborrudnicki
wants to merge
4
commits into
formly-js:master
Choose a base branch
from
sciborrudnicki:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
9486c55
refactor(radio, select): change model in view types, add groups to se…
2f70519
refactor(radioType): remove brackets
bedd971
refactor(radioTest): comment labelProp and valueProp, change disabled
88e2aa1
refactor(selectTest): remove labelProp and valueProp
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
<md-radio-group ng-model="model[options.key]" md-theme="{{to.theme}}"> | ||
<md-radio-group ng-model="model[options.key]" md-theme="{{to.theme}}" ng-disabled="to.disabled"> | ||
<md-radio-button | ||
ng-repeat="option in to.options" | ||
ng-disabled="to.disabled" | ||
ng-value="option[to.valueProp || 'value']"> | ||
{{option[to.labelProp || 'name']}} | ||
ng-repeat="option in to.options track by $index" | ||
aria-label="{{to.options[$index].ariaLabel}}" | ||
class="{{to.options[$index].className}}" | ||
ng-disabled="to.options[$index].disabled || to.disabled" | ||
ng-value="to.options[$index].value"> | ||
{{to.options[$index].name}} | ||
</md-radio-button> | ||
</md-radio-group> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,29 @@ | ||
<md-select ng-model="model[options.key]" md-theme="{{to.theme}}"> | ||
<md-option ng-repeat="option in to.options" ng-value="option[to.valueProp || 'value']"> | ||
{{ option[to.labelProp || 'name'] }} | ||
<!-- If you want to add group to options set first item label --> | ||
<md-optgroup | ||
ng-if="to.options[0].label" | ||
ng-repeat="($groupIndex, group) in to.options" | ||
class="{{to.options[$groupIndex].className}}" | ||
label="{{to.options[$groupIndex].label}}"> | ||
<md-option | ||
ng-repeat="($optionIndex, option) in group.options" | ||
class="{{to.options[$groupIndex].options[$optionIndex].className}}" | ||
ng-disabled="to.options[$groupIndex].options[$optionIndex].disabled" | ||
ng-click="to.options[$groupIndex].options[$optionIndex].ngClick(options, model)" | ||
ng-class="to.options[$groupIndex].options[$optionIndex].ngClass(options, model)" | ||
ng-value="to.options[$groupIndex].options[$optionIndex].value" > | ||
{{to.options[$groupIndex].options[$optionIndex].name}} | ||
</md-option> | ||
</md-optgroup> | ||
|
||
<md-option | ||
ng-if="!to.options[0].label" | ||
ng-repeat="($index, option) in to.options" | ||
class="{{to.options[$index].className}}" | ||
ng-disabled="to.options[$index].disabled" | ||
ng-class="to.options[$index].ngClass(options, model)" | ||
ng-click="to.options[$index].ngClick(options, model)" | ||
ng-value="to.options[$index].value"> | ||
{{to.options[$index].name}} | ||
</md-option> | ||
</md-select> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add the possibility of define the value property name.
Like this
ng-value="to.options[$index][to,valueProp || 'value']"
.Same goes to the next line,
{{to.options[$index].name
replaced by
{{to.options[$index][to.labelProp || 'name']
What do you say?