mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 06:57:02 +08:00
Angular cleanup and content working
This commit is contained in:
129
js/ext/angular/test/subControllers.html
Normal file
129
js/ext/angular/test/subControllers.html
Normal file
@ -0,0 +1,129 @@
|
||||
<html ng-app="sideMenuTest">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Sub Controllers</title>
|
||||
|
||||
<!-- Sets initial viewport load and disables zooming -->
|
||||
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<link href="/vendor/font-awesome/css/font-awesome.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="../../../../dist/ionic.css">
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.2/angular.min.js"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.2/angular-touch.js"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.2/angular-animate.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<side-menu-controller>
|
||||
<div class="full-section" side-menu-content>
|
||||
<header class="bar bar-header bar-dark">
|
||||
<a href="#" class="button"><i class="icon-reorder"></i></a>
|
||||
<h1 class="title">Slide me</h1>
|
||||
</header>
|
||||
<div class="content has-header">
|
||||
<h1>Slide me side to side!</h1>
|
||||
</div>
|
||||
</div>
|
||||
<menu side="left">
|
||||
<h2>Left</h2>
|
||||
<ul class="list">
|
||||
<a href="#" class="list-item" ng-repeat="item in list">
|
||||
{{item.text}}
|
||||
</a>
|
||||
</ul>
|
||||
</menu>
|
||||
<menu side="right">
|
||||
<h2>Items</h2>
|
||||
<tab-controller>
|
||||
<div title="Home" icon="icon-home" class="tab-content">
|
||||
<header class="bar bar-header bar-dark">
|
||||
<h1 class="title">Tab Bars</h1>
|
||||
</header>
|
||||
<content has-header="true" has-tabs="true">
|
||||
<h1>Home</h1>
|
||||
<ul class="list">
|
||||
<a href="#" class="list-item" ng-repeat="item in items">
|
||||
{{item.title}}
|
||||
</a>
|
||||
</ul>
|
||||
</content>
|
||||
</div>
|
||||
|
||||
<div title="About" icon="icon-info" class="tab-content">
|
||||
<header class="bar bar-header bar-success">
|
||||
<h1 class="title">About</h1>
|
||||
</header>
|
||||
<content has-header="true" has-tabs="true">
|
||||
<h1>About Us</h1>
|
||||
</content>
|
||||
</div>
|
||||
|
||||
<div title="Settings" icon="icon-gear" class="tab-content">
|
||||
<header class="bar bar-header bar-dark">
|
||||
<h1 class="title">Settings</h1>
|
||||
</header>
|
||||
<content has-header="true" has-tabs="true">
|
||||
<h1>Settings</h1>
|
||||
</content>
|
||||
</div>
|
||||
</tab-controller>
|
||||
</menu>
|
||||
</side-menu-controller>
|
||||
<script src="../../../../dist/ionic.js"></script>
|
||||
<script src="../src/ionicSideMenu.js"></script>
|
||||
<script src="../src/ionicTabBar.js"></script>
|
||||
<script>
|
||||
angular.module('sideMenuTest', ['ionic.ui'])
|
||||
|
||||
/*
|
||||
var Controller = function(opts) {
|
||||
var _this = this;
|
||||
|
||||
this.el = opts.el;
|
||||
this.animateClass = opts.animateClass;
|
||||
|
||||
// Bind release and drag listeners
|
||||
window.ionic.onGesture('drag', function(e) {
|
||||
_this.onDrag && _this.onDrag(e);
|
||||
}, this.el);
|
||||
|
||||
window.ionic.onGesture('release', function(e) {
|
||||
_this.endDrag && _this._endDrag(e);
|
||||
}, this.el);
|
||||
};
|
||||
Controller.prototype = {
|
||||
onDrag: function(e) {},
|
||||
endDrag: function(e) {},
|
||||
getTranslateX: function() {
|
||||
var r = /translate3d\((-?.+)px/;
|
||||
var d = r.exec(this.el.style.webkitTransform);
|
||||
|
||||
if(d && d.length > 0) {
|
||||
return parseFloat(d[1]);
|
||||
}
|
||||
return 0;
|
||||
},
|
||||
setTranslateX: function(amount) {
|
||||
this.el.style.webkitTransform = 'translate3d(' + amount + 'px, 0, 0)';
|
||||
},
|
||||
enableAnimation: function() {
|
||||
this.el.classList.add(this.animateClass);
|
||||
},
|
||||
disableAnimation: function() {
|
||||
this.el.classList.remove(this.animateClass);
|
||||
}
|
||||
};
|
||||
|
||||
var l = new SideMenu({ el: document.getElementById('my-left-panel'), width: 270 });
|
||||
var r = new SideMenu({ el: document.getElementById('my-right-panel'), width: 270 });
|
||||
var c = new Controller({ el: document.createElement('content') });
|
||||
|
||||
var ctrl = new SideMenuController({
|
||||
left: l,
|
||||
right: r,
|
||||
content: c
|
||||
});
|
||||
*/
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user