Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

docs(guide/Components): 'ctrl' instead of 'this' #14215

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions docs/content/guide/component.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -230,27 +230,27 @@ it upwards to the heroList component, which updates the original data.

function EditableFieldController($scope, $element, $attrs) {
var ctrl = this;
this.editMode = false;
ctrl.editMode = false;

this.handleModeChange = function() {
ctrl.handleModeChange = function() {
if (ctrl.editMode) {
ctrl.onUpdate({value: ctrl.fieldValue});
ctrl.fieldValueCopy = ctrl.fieldValue;
}
ctrl.editMode = !ctrl.editMode;
};

this.reset = function() {
ctrl.reset = function() {
ctrl.fieldValue = ctrl.fieldValueCopy;
};

this.$onInit = function() {
ctrl.$onInit = function() {
// Make a copy of the initial value to be able to reset it later
this.fieldValueCopy = this.fieldValue;
ctrl.fieldValueCopy = ctrl.fieldValue;

// Set a default fieldType
if (!this.fieldType) {
this.fieldType = 'text';
if (!ctrl.fieldType) {
ctrl.fieldType = 'text';
}
};
}
Expand Down