2
2
* Copyright 2014 Drifty Co.
3
3
* http://drifty.com/
4
4
*
5
- * Ionic, v1.0.0-rc.4
5
+ * Ionic, v1.0.0-rc.5
6
6
* A powerful HTML5 mobile app framework.
7
7
* http://ionicframework.com/
8
8
*
@@ -1160,9 +1160,45 @@ function($rootScope, $state, $location, $window, $timeout, $ionicViewSwitcher, $
1160
1160
/**
1161
1161
* @ngdoc method
1162
1162
* @name $ionicHistory#goBack
1163
+ * @param {number= } backCount Optional negative integer setting how many views to go
1164
+ * back. By default it'll go back one view by using the value `-1`. To go back two
1165
+ * views you would use `-2`. If the number goes farther back than the number of views
1166
+ * in the current history's stack then it'll go to the first view in the current history's
1167
+ * stack. If the number is zero or greater then it'll do nothing. It also does not
1168
+ * cross history stacks, meaning it can only go as far back as the current history.
1163
1169
* @description Navigates the app to the back view, if a back view exists.
1164
1170
*/
1165
- goBack : function ( ) {
1171
+ goBack : function ( backCount ) {
1172
+ if ( isDefined ( backCount ) && backCount !== - 1 ) {
1173
+ if ( backCount > - 1 ) return ;
1174
+
1175
+ var currentHistory = viewHistory . histories [ this . currentHistoryId ( ) ] ;
1176
+ var newCursor = currentHistory . cursor + backCount + 1 ;
1177
+ if ( newCursor < 1 ) {
1178
+ newCursor = 1 ;
1179
+ }
1180
+
1181
+ currentHistory . cursor = newCursor ;
1182
+ setNavViews ( currentHistory . stack [ newCursor ] . viewId ) ;
1183
+
1184
+ var cursor = newCursor - 1 ;
1185
+ var clearStateIds = [ ] ;
1186
+ var fwdView = getViewById ( currentHistory . stack [ cursor ] . forwardViewId ) ;
1187
+ while ( fwdView ) {
1188
+ clearStateIds . push ( fwdView . stateId || fwdView . viewId ) ;
1189
+ cursor ++ ;
1190
+ if ( cursor >= currentHistory . stack . length ) break ;
1191
+ fwdView = getViewById ( currentHistory . stack [ cursor ] . forwardViewId ) ;
1192
+ }
1193
+
1194
+ var self = this ;
1195
+ if ( clearStateIds . length ) {
1196
+ $timeout ( function ( ) {
1197
+ self . clearCache ( clearStateIds ) ;
1198
+ } , 600 ) ;
1199
+ }
1200
+ }
1201
+
1166
1202
viewHistory . backView && viewHistory . backView . go ( ) ;
1167
1203
} ,
1168
1204
@@ -1217,10 +1253,10 @@ function($rootScope, $state, $location, $window, $timeout, $ionicViewSwitcher, $
1217
1253
* @description Removes all cached views within every {@link ionic.directive:ionNavView}.
1218
1254
* This both removes the view element from the DOM, and destroy it's scope.
1219
1255
*/
1220
- clearCache : function ( ) {
1256
+ clearCache : function ( stateIds ) {
1221
1257
$timeout ( function ( ) {
1222
1258
$ionicNavViewDelegate . _instances . forEach ( function ( instance ) {
1223
- instance . clearCache ( ) ;
1259
+ instance . clearCache ( stateIds ) ;
1224
1260
} ) ;
1225
1261
} ) ;
1226
1262
} ,
@@ -1379,8 +1415,8 @@ function($rootScope, $state, $location, $document, $ionicPlatform, $ionicHistory
1379
1415
}
1380
1416
} ) ;
1381
1417
1382
- $rootScope . $ionicGoBack = function ( ) {
1383
- $ionicHistory . goBack ( ) ;
1418
+ $rootScope . $ionicGoBack = function ( backCount ) {
1419
+ $ionicHistory . goBack ( backCount ) ;
1384
1420
} ;
1385
1421
1386
1422
// Set the document title when a new view is shown
@@ -1756,6 +1792,14 @@ IonicModule
1756
1792
1757
1793
} ) ;
1758
1794
1795
+ // Windows Phone
1796
+ // -------------------------
1797
+ setPlatformConfig ( 'windowsphone' , {
1798
+ scrolling : {
1799
+ jsScrolling : false
1800
+ }
1801
+ } ) ;
1802
+
1759
1803
1760
1804
provider . transitions = {
1761
1805
views : { } ,
@@ -1804,7 +1848,7 @@ IonicModule
1804
1848
1805
1849
function setStyles ( ctrl , opacity , titleX , backTextX ) {
1806
1850
var css = { } ;
1807
- css [ ionic . CSS . TRANSITION_DURATION ] = d . shouldAnimate ? '' : 0 ;
1851
+ css [ ionic . CSS . TRANSITION_DURATION ] = d . shouldAnimate ? '' : '0ms' ;
1808
1852
css . opacity = opacity === 1 ? '' : opacity ;
1809
1853
1810
1854
ctrl . setCss ( 'buttons-left' , css ) ;
@@ -2019,7 +2063,14 @@ IonicModule
2019
2063
provider . $get = function ( ) {
2020
2064
return provider ;
2021
2065
} ;
2022
- } ) ;
2066
+ } )
2067
+ // Fix for URLs in Cordova apps on Windows Phone
2068
+ // http://blogs.msdn.com/b/msdn_answers/archive/2015/02/10/
2069
+ // running-cordova-apps-on-windows-and-windows-phone-8-1-using-ionic-angularjs-and-other-frameworks.aspx
2070
+ . config ( [ '$compileProvider' , function ( $compileProvider ) {
2071
+ $compileProvider . aHrefSanitizationWhitelist ( / ^ \s * ( h t t p s ? | f t p | m a i l t o | f i l e | g h t t p s ? | m s - a p p x | x - w m a p p 0 ) : / ) ;
2072
+ $compileProvider . imgSrcSanitizationWhitelist ( / ^ \s * ( h t t p s ? | f t p | f i l e | m s - a p p x | x - w m a p p 0 ) : | d a t a : i m a g e \/ / ) ;
2073
+ } ] ) ;
2023
2074
2024
2075
2025
2076
var LOADING_TPL =
@@ -2364,7 +2415,9 @@ function($rootScope, $ionicBody, $compile, $timeout, $ionicPlatform, $ionicTempl
2364
2415
* - `{string=}` `animation` The animation to show & hide with.
2365
2416
* Default: 'slide-in-up'
2366
2417
* - `{boolean=}` `focusFirstInput` Whether to autofocus the first input of
2367
- * the modal when shown. Default: false.
2418
+ * the modal when shown. Will only show the keyboard on iOS, to force the keyboard to show
2419
+ * on Android, please use the [Ionic keyboard plugin](https://github.com/driftyco/ionic-plugin-keyboard#keyboardshow).
2420
+ * Default: false.
2368
2421
* - `{boolean=}` `backdropClickToClose` Whether to close the modal on clicking the backdrop.
2369
2422
* Default: true.
2370
2423
* - `{boolean=}` `hardwareBackButtonClose` Whether the modal can be closed using the hardware
@@ -2389,6 +2442,10 @@ function($rootScope, $ionicBody, $compile, $timeout, $ionicPlatform, $ionicTempl
2389
2442
return $$q . when ( ) ;
2390
2443
}
2391
2444
2445
+ // on iOS, clicks will sometimes bleed through/ghost click on underlying
2446
+ // elements
2447
+ $ionicClickBlock . show ( 600 ) ;
2448
+
2392
2449
var modalEl = jqLite ( self . modalEl ) ;
2393
2450
2394
2451
self . el . classList . remove ( 'hide' ) ;
@@ -2417,7 +2474,6 @@ function($rootScope, $ionicBody, $compile, $timeout, $ionicPlatform, $ionicTempl
2417
2474
ionic . on ( 'resize' , self . _onWindowResize , window ) ;
2418
2475
}
2419
2476
2420
-
2421
2477
modalEl . addClass ( 'ng-enter active' )
2422
2478
. removeClass ( 'ng-leave ng-leave-active' ) ;
2423
2479
@@ -6229,18 +6285,32 @@ function($scope, $element, $attrs, $compile, $controller, $ionicNavBarDelegate,
6229
6285
} ;
6230
6286
6231
6287
6232
- self . clearCache = function ( ) {
6288
+ self . clearCache = function ( stateIds ) {
6233
6289
var viewElements = $element . children ( ) ;
6234
- var viewElement , viewScope ;
6290
+ var viewElement , viewScope , x , l , y , eleIdentifier ;
6235
6291
6236
- for ( var x = 0 , l = viewElements . length ; x < l ; x ++ ) {
6292
+ for ( x = 0 , l = viewElements . length ; x < l ; x ++ ) {
6237
6293
viewElement = viewElements . eq ( x ) ;
6294
+
6295
+ if ( stateIds ) {
6296
+ eleIdentifier = viewElement . data ( DATA_ELE_IDENTIFIER ) ;
6297
+
6298
+ for ( y = 0 ; y < stateIds . length ; y ++ ) {
6299
+ if ( eleIdentifier === stateIds [ y ] ) {
6300
+ $ionicViewSwitcher . destroyViewEle ( viewElement ) ;
6301
+ }
6302
+ }
6303
+ continue ;
6304
+ }
6305
+
6238
6306
if ( navViewAttr ( viewElement ) == VIEW_STATUS_CACHED ) {
6239
6307
$ionicViewSwitcher . destroyViewEle ( viewElement ) ;
6308
+
6240
6309
} else if ( navViewAttr ( viewElement ) == VIEW_STATUS_ACTIVE ) {
6241
6310
viewScope = viewElement . scope ( ) ;
6242
6311
viewScope && viewScope . $broadcast ( '$ionicView.clearCache' ) ;
6243
6312
}
6313
+
6244
6314
}
6245
6315
} ;
6246
6316
@@ -7852,7 +7922,11 @@ function($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody, $io
7852
7922
var spinnerName , spinner ;
7853
7923
7854
7924
this . init = function ( ) {
7855
- spinnerName = $attrs . icon || ionic . Platform . platform ( ) ;
7925
+ var override = null ;
7926
+ if ( ionic . Platform . platform ( ) === 'windowsphone' ) {
7927
+ override = 'android' ;
7928
+ }
7929
+ spinnerName = $attrs . icon || override || ionic . Platform . platform ( ) ;
7856
7930
spinner = spinners [ spinnerName ] ;
7857
7931
if ( ! spinner ) {
7858
7932
spinnerName = 'ios' ;
@@ -9275,6 +9349,9 @@ function RepeatManagerFactory($rootScope, $window, $$rAF) {
9275
9349
* directive, and infinite scrolling with the {@link ionic.directive:ionInfiniteScroll}
9276
9350
* directive.
9277
9351
*
9352
+ * If there is any dynamic content inside the ion-content, be sure to call `.resize()` with {@link ionic.service:$ionicScrollDelegate}
9353
+ * after the content as been added.
9354
+ *
9278
9355
* Be aware that this directive gets its own child scope. If you do not understand why this
9279
9356
* is important, you can read [https://docs.angularjs.org/guide/scope](https://docs.angularjs.org/guide/scope).
9280
9357
*
@@ -10877,7 +10954,7 @@ IonicModule
10877
10954
}
10878
10955
10879
10956
if ( ! tAttrs . ngClick ) {
10880
- buttonEle . setAttribute ( 'ng-click' , '$ionicGoBack($event )' ) ;
10957
+ buttonEle . setAttribute ( 'ng-click' , '$ionicGoBack()' ) ;
10881
10958
}
10882
10959
10883
10960
buttonEle . className = 'button back-button hide buttons ' + ( tElement . attr ( 'class' ) || '' ) ;
0 commit comments