mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 15:07:13 +08:00
Toggle sjhit
This commit is contained in:
@ -166,7 +166,11 @@
|
|||||||
</header>
|
</header>
|
||||||
<main class="content padded has-header">
|
<main class="content padded has-header">
|
||||||
<list header="GENERAL">
|
<list header="GENERAL">
|
||||||
<a class="list-item" href="#" ng-click="logout()">Log out</a>
|
<list-item>Account details <i class="icon-chevron-right"></i></list-item>
|
||||||
|
<list-item>Account details <toggle ng-model="settings.isSmallText"></toggle></i></list-item>
|
||||||
|
</list>
|
||||||
|
<list header="ACCOUNT">
|
||||||
|
<list-item ng-click="logout()">Log out</list-item>
|
||||||
</list>
|
</list>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
3
js/ext/angular/src/directive/ionicList.js
vendored
3
js/ext/angular/src/directive/ionicList.js
vendored
@ -33,6 +33,7 @@ angular.module('ionic.ui.list', ['ionic.service', 'ngAnimate'])
|
|||||||
return {
|
return {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
replace: true,
|
replace: true,
|
||||||
|
transclude: true,
|
||||||
scope: {
|
scope: {
|
||||||
isEditing: '=',
|
isEditing: '=',
|
||||||
items: '=',
|
items: '=',
|
||||||
@ -52,6 +53,8 @@ angular.module('ionic.ui.list', ['ionic.service', 'ngAnimate'])
|
|||||||
if(attr.animation) {
|
if(attr.animation) {
|
||||||
$element.addClass(attr.animation);
|
$element.addClass(attr.animation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$element.append(transclude($scope));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
35
js/ext/angular/src/directive/ionicToggle.js
vendored
Normal file
35
js/ext/angular/src/directive/ionicToggle.js
vendored
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
angular.module('ionic.ui.content', [])
|
||||||
|
|
||||||
|
// The content directive is a core scrollable content area
|
||||||
|
// that is part of many View hierarchies
|
||||||
|
.directive('toggle', function() {
|
||||||
|
return {
|
||||||
|
restrict: 'E',
|
||||||
|
replace: true,
|
||||||
|
scope: {},
|
||||||
|
require: '?ngModel',
|
||||||
|
template: '<div class="toggle">' +
|
||||||
|
' <input type="checkbox">'+
|
||||||
|
' <div class="track">' +
|
||||||
|
' <div class="handle"></div>' +
|
||||||
|
'</div>',
|
||||||
|
|
||||||
|
link: function($scope, $element, $attr, ngModel) {
|
||||||
|
var checkbox;
|
||||||
|
|
||||||
|
$scope.toggle = new ionic.views.Toggle({ el: $element[0] });
|
||||||
|
|
||||||
|
if(!ngModel) { return; }
|
||||||
|
|
||||||
|
checkbox = $element.children()[0];
|
||||||
|
|
||||||
|
if(!checkbox) { return; }
|
||||||
|
|
||||||
|
ngModel.$render = function() {
|
||||||
|
checkbox.checked = ngModel.$viewValue;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
@ -8,6 +8,7 @@
|
|||||||
this.handle = opts.handle;
|
this.handle = opts.handle;
|
||||||
this.openPercent = -1;
|
this.openPercent = -1;
|
||||||
|
|
||||||
|
/*
|
||||||
// remember that this element, and all its children are apart of a component
|
// remember that this element, and all its children are apart of a component
|
||||||
// and assign the component instance to each element so the lookups
|
// and assign the component instance to each element so the lookups
|
||||||
// only has to go through this process just once
|
// only has to go through this process just once
|
||||||
@ -16,6 +17,7 @@
|
|||||||
this.track.isComponent = true;
|
this.track.isComponent = true;
|
||||||
this.handle.component = this;
|
this.handle.component = this;
|
||||||
this.handle.isComponent = true;
|
this.handle.isComponent = true;
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
ionic.views.Toggle.prototype = {
|
ionic.views.Toggle.prototype = {
|
||||||
|
|||||||
Reference in New Issue
Block a user