mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
BREAKING CHANGE: $ionicScrollDelegate, $ionicSlideBoxDelegate, and
$ionicSideMenuDelegate have been removed.
- $ionicScrollDelegate has been changed to $ionicScrollController.
Documentation:
[ionContent](
http://ajoslin.github.io/docs/nightly/api/directive/ionContent),
[ionScroll](
http://ajoslin.github.io/docs/nightly/api/directive/ionScroll)
Change your code from this:
```html
<ion-content ng-controller="MyCtrl">
<button ng-click="scrollBottom()">Scroll to bottom!</button>
</ion-content>
```
```js
function MyCtrl($scope, $ionicScrollDelegate) {
$scope.scrollBottom = function() {
$ionicScrollDelegate.scrollBottom();
};
}
```
To this:
```html
<!-- optional attr controller-bind, see docs -->
<ion-content ng-controller="MyCtrl">
<button ng-click="scrollBottom()">Scroll to bottom!</button>
</ion-content>
```
```js
function MyCtrl($scope) {
$scope.scrollBottom = function() {
$scope.$ionicScrollController.scrollBottom();
};
}
```
- $ionicSideMenuDelegate has been changed to
$ionicSideMenusController. Documentation:
[ionSideMenus](http://ajoslin.github.io/docs/nightly/api/directive/ionSideMenus)
Change your code from this:
```html
<ion-side-menus>
<ion-side-menu side="left">Side Menu Left</ion-side-menu>
<ion-pane ion-side-menu-content ng-controller="MyCtrl">
<button ng-click="toggleLeftMenu()">
Toggle Left Menu!
</button>
</ion-pane>
</ion-side-menus>
```
```js
function MyCtrl($scope, $ionicSideMenuDelegate) {
$scope.toggleLeftMenu = function() {
$ionicSideMenuDelegate.toggleLeft();
};
}
```
To this:
```html
<!-- optional attr controller-bind, see documentation -->
<ion-side-menus>
<ion-side-menu side="left">Side Menu Left</ion-side-menu>
<ion-pane ion-side-menu-content ng-controller="MyCtrl">
<button ng-click="toggleLeftMenu()">
Toggle Left Menu!
</button>
</ion-pane>
</ion-side-menus>
```
```js
function MyCtrl($scope) {
$scope.toggleLeftMenu = function() {
$scope.$ionicSideMenuController.toggleLeft();
};
}
```
- $ionicSlideBoxDelegate has been removed and upgraded to
$ionicSlideBoxController. It had only one method that
was unneeded. [Documentation](
http://ajoslin.github.io/docs/nightly/api/directive/ionSlideBox)
81 lines
2.1 KiB
HTML
81 lines
2.1 KiB
HTML
<html ng-app="slideBoxTest">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Dynamic Slide Box</title>
|
|
|
|
<!-- Sets initial viewport load and disables zooming -->
|
|
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
|
|
<link rel="stylesheet" href="../../../../dist/css/ionic.css">
|
|
<script src="../../../../dist/js/ionic.bundle.js"></script>
|
|
<style>
|
|
.slider-slide {
|
|
padding-top: 80px;
|
|
color: #000;
|
|
background-color: #fff;
|
|
text-align: center;
|
|
|
|
font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
|
|
font-weight: 300;
|
|
}
|
|
.slider-pager .slider-pager-page {
|
|
color: #000;
|
|
}
|
|
|
|
#logo {
|
|
margin: 30px 0px;
|
|
}
|
|
|
|
#list {
|
|
width: 170px;
|
|
margin: 30px auto;
|
|
font-size: 20px;
|
|
}
|
|
#list ol {
|
|
margin-top: 30px;
|
|
}
|
|
#list ol li {
|
|
text-align: left;
|
|
list-style: decimal;
|
|
margin: 10px 0px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<div ng-controller="SlideCtrl">
|
|
<ion-pane>
|
|
<ion-header-bar left-buttons="leftButtons" right-buttons="rightButtons" title=""></ion-header-bar>
|
|
<ion-content class="has-header">
|
|
<ion-slide-box>
|
|
<ion-slide ng-repeat="page in pages">
|
|
{{page.text}}
|
|
</ion-slide>
|
|
</ion-slide-box>
|
|
</ion-content>
|
|
</ion-pane>
|
|
</div>
|
|
<script>
|
|
angular.module('slideBoxTest', ['ionic'])
|
|
|
|
.controller('SlideCtrl', function($scope, $timeout) {
|
|
|
|
$timeout(function() {
|
|
$scope.pages = [ {
|
|
text:
|
|
'This is a really long page text\
|
|
This is a really long page text\
|
|
This is a really long page text\
|
|
This is a really long page text\
|
|
This is a really long page text\
|
|
This is a really long page text\
|
|
This is a really long page text'
|
|
}
|
|
];
|
|
}, 100);
|
|
})
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|
|
|