344840 (10) [Avatar] Offline
#1
I don't understand the statement:
We are assigning the value of $ionicActionSheet.show() to the sheet variable, which
returns a function that can close the sheet. At any point we could call sheet() to close it.


I cannot understand how and why sheet() would close the ActionSheet.
Also, I cannot find any usage of sheet() in the code.

Can you elaborate?
Thanks.
jeremy.wilken (208) [Avatar] Offline
#2
Great question. I don't use it in the example, and technically don't need to have assigned that call to sheet. What happens is when you call $ionicActionSheet.show() it returns a function, and when you call that function it will close the action sheet. So the variable sheet is assigned to this function, and we could later call sheet() to close the action sheet. You might want to do this in any case where you want the action sheet to close without the user tapping on the screen (such as if you needed to show an alert, you could first close the action sheet, or you could autohide it after X seconds).

http://ionicframework.com/docs/api/service/$ionicActionSheet/
344840 (10) [Avatar] Offline
#3
Thank you, for all your answers.
I think I should read the docs to get further.
Anyway, I think your book will be great introduction to Ionic.

jeremy.wilken (208) [Avatar] Offline
#4
Ionic in Action is designed to be a hands on, fast paced way to learn the majority how to build apps with Ionic. This book is part of the 'In Action' series, which is not meant to cover every aspect of Ionic, because it would read more like a documentation manual and Ionic's documentation is already great at that.

Jeremy