22 * Copyright 2014 Drifty Co.
33 * http://drifty.com/
44 *
5- * Ionic, v1.0.0-rc.4
5+ * Ionic, v1.0.0-rc.5
66 * A powerful HTML5 mobile app framework.
77 * http://ionicframework.com/
88 *
@@ -1160,9 +1160,45 @@ function($rootScope, $state, $location, $window, $timeout, $ionicViewSwitcher, $
11601160 /**
11611161 * @ngdoc method
11621162 * @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.
11631169 * @description Navigates the app to the back view, if a back view exists.
11641170 */
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+
11661202 viewHistory . backView && viewHistory . backView . go ( ) ;
11671203 } ,
11681204
@@ -1217,10 +1253,10 @@ function($rootScope, $state, $location, $window, $timeout, $ionicViewSwitcher, $
12171253 * @description Removes all cached views within every {@link ionic.directive:ionNavView}.
12181254 * This both removes the view element from the DOM, and destroy it's scope.
12191255 */
1220- clearCache : function ( ) {
1256+ clearCache : function ( stateIds ) {
12211257 $timeout ( function ( ) {
12221258 $ionicNavViewDelegate . _instances . forEach ( function ( instance ) {
1223- instance . clearCache ( ) ;
1259+ instance . clearCache ( stateIds ) ;
12241260 } ) ;
12251261 } ) ;
12261262 } ,
@@ -1379,8 +1415,8 @@ function($rootScope, $state, $location, $document, $ionicPlatform, $ionicHistory
13791415 }
13801416 } ) ;
13811417
1382- $rootScope . $ionicGoBack = function ( ) {
1383- $ionicHistory . goBack ( ) ;
1418+ $rootScope . $ionicGoBack = function ( backCount ) {
1419+ $ionicHistory . goBack ( backCount ) ;
13841420 } ;
13851421
13861422 // Set the document title when a new view is shown
@@ -1756,6 +1792,14 @@ IonicModule
17561792
17571793 } ) ;
17581794
1795+ // Windows Phone
1796+ // -------------------------
1797+ setPlatformConfig ( 'windowsphone' , {
1798+ scrolling : {
1799+ jsScrolling : false
1800+ }
1801+ } ) ;
1802+
17591803
17601804 provider . transitions = {
17611805 views : { } ,
@@ -1804,7 +1848,7 @@ IonicModule
18041848
18051849 function setStyles ( ctrl , opacity , titleX , backTextX ) {
18061850 var css = { } ;
1807- css [ ionic . CSS . TRANSITION_DURATION ] = d . shouldAnimate ? '' : 0 ;
1851+ css [ ionic . CSS . TRANSITION_DURATION ] = d . shouldAnimate ? '' : '0ms' ;
18081852 css . opacity = opacity === 1 ? '' : opacity ;
18091853
18101854 ctrl . setCss ( 'buttons-left' , css ) ;
@@ -2019,7 +2063,14 @@ IonicModule
20192063 provider . $get = function ( ) {
20202064 return provider ;
20212065 } ;
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+ } ] ) ;
20232074
20242075
20252076var LOADING_TPL =
@@ -2364,7 +2415,9 @@ function($rootScope, $ionicBody, $compile, $timeout, $ionicPlatform, $ionicTempl
23642415 * - `{string=}` `animation` The animation to show & hide with.
23652416 * Default: 'slide-in-up'
23662417 * - `{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.
23682421 * - `{boolean=}` `backdropClickToClose` Whether to close the modal on clicking the backdrop.
23692422 * Default: true.
23702423 * - `{boolean=}` `hardwareBackButtonClose` Whether the modal can be closed using the hardware
@@ -2389,6 +2442,10 @@ function($rootScope, $ionicBody, $compile, $timeout, $ionicPlatform, $ionicTempl
23892442 return $$q . when ( ) ;
23902443 }
23912444
2445+ // on iOS, clicks will sometimes bleed through/ghost click on underlying
2446+ // elements
2447+ $ionicClickBlock . show ( 600 ) ;
2448+
23922449 var modalEl = jqLite ( self . modalEl ) ;
23932450
23942451 self . el . classList . remove ( 'hide' ) ;
@@ -2417,7 +2474,6 @@ function($rootScope, $ionicBody, $compile, $timeout, $ionicPlatform, $ionicTempl
24172474 ionic . on ( 'resize' , self . _onWindowResize , window ) ;
24182475 }
24192476
2420-
24212477 modalEl . addClass ( 'ng-enter active' )
24222478 . removeClass ( 'ng-leave ng-leave-active' ) ;
24232479
@@ -6229,18 +6285,32 @@ function($scope, $element, $attrs, $compile, $controller, $ionicNavBarDelegate,
62296285 } ;
62306286
62316287
6232- self . clearCache = function ( ) {
6288+ self . clearCache = function ( stateIds ) {
62336289 var viewElements = $element . children ( ) ;
6234- var viewElement , viewScope ;
6290+ var viewElement , viewScope , x , l , y , eleIdentifier ;
62356291
6236- for ( var x = 0 , l = viewElements . length ; x < l ; x ++ ) {
6292+ for ( x = 0 , l = viewElements . length ; x < l ; x ++ ) {
62376293 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+
62386306 if ( navViewAttr ( viewElement ) == VIEW_STATUS_CACHED ) {
62396307 $ionicViewSwitcher . destroyViewEle ( viewElement ) ;
6308+
62406309 } else if ( navViewAttr ( viewElement ) == VIEW_STATUS_ACTIVE ) {
62416310 viewScope = viewElement . scope ( ) ;
62426311 viewScope && viewScope . $broadcast ( '$ionicView.clearCache' ) ;
62436312 }
6313+
62446314 }
62456315 } ;
62466316
@@ -7852,7 +7922,11 @@ function($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody, $io
78527922 var spinnerName , spinner ;
78537923
78547924 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 ( ) ;
78567930 spinner = spinners [ spinnerName ] ;
78577931 if ( ! spinner ) {
78587932 spinnerName = 'ios' ;
@@ -9275,6 +9349,9 @@ function RepeatManagerFactory($rootScope, $window, $$rAF) {
92759349 * directive, and infinite scrolling with the {@link ionic.directive:ionInfiniteScroll}
92769350 * directive.
92779351 *
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+ *
92789355 * Be aware that this directive gets its own child scope. If you do not understand why this
92799356 * is important, you can read [https://docs.angularjs.org/guide/scope](https://docs.angularjs.org/guide/scope).
92809357 *
@@ -10877,7 +10954,7 @@ IonicModule
1087710954 }
1087810955
1087910956 if ( ! tAttrs . ngClick ) {
10880- buttonEle . setAttribute ( 'ng-click' , '$ionicGoBack($event )' ) ;
10957+ buttonEle . setAttribute ( 'ng-click' , '$ionicGoBack()' ) ;
1088110958 }
1088210959
1088310960 buttonEle . className = 'button back-button hide buttons ' + ( tElement . attr ( 'class' ) || '' ) ;
0 commit comments