Conflicts:
	js/ext/angular/test/list.html
This commit is contained in:
Adam Bradley
2014-03-20 14:21:54 -05:00
4 changed files with 45 additions and 23 deletions

View File

@@ -104,11 +104,11 @@ angular.module('ionic.ui.list', ['ngAnimate'])
$scope.deleteClick = function() {
if($attr.onDelete) {
// this item has an on-delete attribute
$scope.onDelete({ item: $scope.item });
$scope.onDelete({ item: $scope.item, index: $scope.$parent.$index });
} else if($parentAttrs.onDelete) {
// run the parent list's onDelete method
// if it doesn't exist nothing will happen
$parentScope.onDelete({ item: $scope.item });
$parentScope.onDelete({ item: $scope.item, index: $scope.$parent.$index });
}
};

View File

@@ -53,8 +53,10 @@ angular.module('ionic.service.popup', ['ionic.service.templateLoad'])
console.log('Tapped!', res);
}, function(err) {
console.log('Err:', err);
}, function(msg) {
console.log('message:', msg);
}, function(popup) {
// If you need to access the popup directly, do it in the notify method
// This is also where you can programatically close the popup:
// popup.close();
});
// A confirm dialog
@@ -252,7 +254,10 @@ angular.module('ionic.service.popup', ['ionic.service.templateLoad'])
var constructPopupOnScope = function(element, scope) {
var popup = {
el: element[0],
scope: scope
scope: scope,
close: function() {
popAndRemove(this);
}
};
scope.popup = popup;
@@ -318,13 +323,20 @@ angular.module('ionic.service.popup', ['ionic.service.templateLoad'])
};
// Public API
return {
/**
* @private
*/
showPopup: function(data) {
var q = $q.defer();
createPopup(data, q).then(function(popup, scope) {
// Send the popup back
q.notify(popup);
// We constructed the popup, push it on the stack and show it
pushAndShow(popup, data);
@@ -340,7 +352,8 @@ angular.module('ionic.service.popup', ['ionic.service.templateLoad'])
* @name $ionicPopup#show
* @description show a complex popup. This is the master show function for all popups
* @param {data} object The options for showing a popup, of the form:
*
* @returns {Promise} an Angular promise which resolves when the user enters the correct data, and also
* sends the constructed popup in the notify function (for programatic closing, as shown in the example above).
* ```
* {
* content: '', // String. The content of the popup

View File

@@ -102,7 +102,7 @@
on-refresh="refreshItems()"
on-reorder="onReorder(el, start, end)"
refresh-complete="refreshComplete"
on-delete="deleteListItem(item)"
on-delete="deleteListItem(item, index)"
delete-icon="ion-minus-circled"
reorder-icon="ion-navicon"
animation="my-repeat-animation"
@@ -112,7 +112,7 @@
option-buttons="optionButtons1">
<!-- shows that the item directive does not need attributes and can get values from the list attributes -->
<ion-item ion-item="item" ng-href="#" ng-click="itemClick()" class="item-thumbnail-left" ng-repeat="item in items">
<ion-item item="item" ng-href="#" ng-click="itemClick()" class="item-thumbnail-left" ng-repeat="item in items" ng-class="{ active: item.isActive}">
<img ng-src="{{item.face}}">
<h2>{{item.from}}</h2>
<p>{{item.text}}</p>
@@ -134,7 +134,7 @@
</ion-item>
<!-- shows that the item directive can receive many attributes and overrides the list attributes -->
<ion-item on-delete="deleteItem(item)"
<ion-item on-delete="deleteItem(item, index)"
delete-icon="ion-trash-a"
reorder-icon="ion-navicon-round"
can-delete="true"
@@ -227,11 +227,11 @@
};
// Item Methods/Properties
$scope.deleteItem = function(item) {
alert('onDelete from the "item" directive on-delete attribute. Lets not delete this item today ok!');
$scope.deleteItem = function(item, index) {
console.log('onDelete from the "item" directive on-delete attribute. Lets not delete this item today ok!', item, index);
};
$scope.deleteListItem = function(item) {
alert('onDelete from the "list" on-delete attribute');
$scope.deleteListItem = function(item, index) {
console.log('onDelete from the "list" on-delete attribute', item, index);
$scope.items.splice($scope.items.indexOf(item), 1);
};
$scope.onReorder = function(el, start, end) {

View File

@@ -11,11 +11,14 @@
</head>
<body ng-controller="PopupCtrl">
<button class="button button-dark" ng-click="showPopup()">Generic</button>
<button class="button button-primary" ng-click="showConfirm()">Confirm</button>
<button class="button button-balanced" ng-click="showPrompt()">Prompt</button>
<button class="button button-balanced" ng-click="showPasswordPrompt()">Password Prompt</button>
<button class="button button-positive" ng-click="showAlert()">Alert</button>
<ion-content>
<button class="button button-dark" ng-click="showPopup()">Generic</button>
<button class="button button-primary" ng-click="showConfirm()">Confirm</button>
<button class="button button-balanced" ng-click="showPrompt()">Prompt</button>
<button class="button button-balanced" ng-click="showPasswordPrompt()">Password Prompt</button>
<button class="button button-positive" ng-click="showAlert()">Alert</button>
<div style="height: 3000px; width: 50px; background-color: rgba(0,0,0,0.5);"></div>
</ion-content>
<script id="popup-template.html" type="text/ng-template">
<input ng-model="data.wifi" type="text" placeholder="Password">
@@ -94,11 +97,17 @@
};
$scope.showAlert = function() {
$ionicPopup.alert({
title: 'Don\'t eat that!',
content: 'It might taste good'
}).then(function(res) {
console.log('Thank you for not eating my delicious ice cream cone');
});
title: 'Draft Saved',
content: 'Your Data has been saved!'
}).then(function(res) {
console.log('Your Data has been saved!');
}, function(err) {},
function(popup) {
console.log('Got popup', popup);
$timeout(function() {
popup.close();
}, 1000);
});
};
});
</script>