File tree Expand file tree Collapse file tree 4 files changed +57
-15
lines changed Expand file tree Collapse file tree 4 files changed +57
-15
lines changed Original file line number Diff line number Diff line change 390
390
. controller ( '$ionicSpinner' , [
391
391
'$element' ,
392
392
'$attrs' ,
393
- function ( $element , $attrs ) {
394
- var spinnerName , spinner ;
393
+ '$ionicConfig' ,
394
+ function ( $element , $attrs , $ionicConfig ) {
395
+ var spinnerName ;
395
396
396
397
this . init = function ( ) {
397
- var override = null ;
398
- if ( ionic . Platform . platform ( ) === 'windowsphone' ) {
399
- override = 'android' ;
400
- }
401
- spinnerName = $attrs . icon || override || ionic . Platform . platform ( ) ;
402
- spinner = spinners [ spinnerName ] ;
403
- if ( ! spinner ) {
404
- spinnerName = 'ios' ;
405
- spinner = spinners . ios ;
406
- }
398
+ spinnerName = $attrs . icon || $ionicConfig . spinner . icon ( ) ;
407
399
408
400
var container = document . createElement ( 'div' ) ;
409
401
createSvgElement ( 'svg' , {
Original file line number Diff line number Diff line change 138
138
* @returns {string }
139
139
*/
140
140
141
+ /**
142
+ * @ngdoc method
143
+ * @name $ionicConfigProvider#spinner.icon
144
+ * @description Spinner icon.
145
+ * @param {string } value
146
+ * @returns {string }
147
+ */
148
+
141
149
/**
142
150
* @ngdoc method
143
151
* @name $ionicConfigProvider#tabs.style
@@ -253,6 +261,9 @@ IonicModule
253
261
scrolling : {
254
262
jsScrolling : PLATFORM
255
263
} ,
264
+ spinner : {
265
+ icon : PLATFORM
266
+ } ,
256
267
tabs : {
257
268
style : PLATFORM ,
258
269
position : PLATFORM
@@ -300,6 +311,10 @@ IonicModule
300
311
jsScrolling : true
301
312
} ,
302
313
314
+ spinner : {
315
+ icon : 'ios'
316
+ } ,
317
+
303
318
tabs : {
304
319
style : 'standard' ,
305
320
position : 'bottom'
@@ -345,6 +360,10 @@ IonicModule
345
360
toggle : 'small'
346
361
} ,
347
362
363
+ spinner : {
364
+ icon : 'android'
365
+ } ,
366
+
348
367
tabs : {
349
368
style : 'striped' ,
350
369
position : 'top'
@@ -358,6 +377,9 @@ IonicModule
358
377
//scrolling: {
359
378
// jsScrolling: false
360
379
//}
380
+ spinner : {
381
+ icon : 'android'
382
+ }
361
383
} ) ;
362
384
363
385
Original file line number Diff line number Diff line change 1
1
<!DOCTYPE html>
2
- < html ng-app ="ionic ">
2
+ < html ng-app ="ionic.example ">
3
3
< head >
4
4
< meta charset ="utf-8 ">
5
5
< title > Spinners</ title >
6
6
< meta name ="viewport " content ="initial-scale=1, maximum-scale=1, user-scalable=no ">
7
7
< link rel ="stylesheet " href ="../../../../dist/css/ionic.css ">
8
8
< script src ="../../../../dist/js/ionic.bundle.js "> </ script >
9
9
</ head >
10
- < body >
10
+ < body ng-controller =" SpinnerCtrl " > >
11
11
12
12
< header class ="bar bar-header bar-royal ">
13
13
< h1 class ="title "> Spinners</ h1 >
@@ -124,6 +124,11 @@ <h1 class="title">Spinners</h1>
124
124
</ tbody > </ table >
125
125
126
126
</ ion-content >
127
-
127
+ < script >
128
+ angular . module ( 'ionic.example' , [ 'ionic' ] )
129
+ . controller ( 'SpinnerCtrl' , function ( $scope , $ionicConfig ) {
130
+ //$ionicConfig.spinner.icon('lines');
131
+ } ) ;
132
+ </ script >
128
133
</ body >
129
134
</ html >
Original file line number Diff line number Diff line change
1
+ describe ( 'Ionic Spinner' , function ( ) {
2
+ var el , scope , compile ;
3
+
4
+ beforeEach ( module ( 'ionic' ) ) ;
5
+
6
+ beforeEach ( inject ( function ( $compile , $rootScope ) {
7
+ compile = $compile ;
8
+ scope = $rootScope ;
9
+ } ) ) ;
10
+
11
+ it ( 'should compile and output an svg' , function ( ) {
12
+ el = compile ( '<ion-spinner>' ) ( scope ) ;
13
+ var spinner = el . find ( 'svg' ) ;
14
+ expect ( spinner . length ) . toEqual ( 1 ) ;
15
+ } ) ;
16
+
17
+ it ( 'should add config setting class' , inject ( function ( $ionicConfig ) {
18
+ $ionicConfig . spinner . icon ( 'android' ) ;
19
+ el = compile ( '<ion-spinner>' ) ( scope ) ;
20
+ expect ( el . is ( '.spinner-android' ) ) . toEqual ( true ) ;
21
+ } ) ) ;
22
+
23
+ } ) ;
You can’t perform that action at this time.
0 commit comments