2015-09-07 80 views
0

我需要覆蓋ionRefresher指令,以便當它被拉下時,它不應該顯示任何加載跡象。刪除離子清新藍色背景

這可能嗎?

我試着這樣做:

.directive('ionRefresher', function() { 
    return { 
    template: '<div></div>' 

    }; 
}) 

我已經設置它是這樣的:

<ion-refresher 
    pulling-text="" 
    refreshing-text="" 
    refreshing-icon="" 
    pulling-icon="" 
    on-refresh="changeSlide()"> 
</ion-refresher> 

但我仍然得到拉下背景淺藍色。我也不想要那樣。我可以改變它嗎?

Error: [$compile:multidir] Multiple directives [ionRefresher, ionRefresher (module: starter.controllers)] asking for template on: <div class="scroll-refresher invisible" collection-repeat-ignore="" pulling-text="" refreshing-text="" refreshing-icon="" pulling-icon="" on-refresh="changeSlide()"> 
http://errors.angularjs.org/1.4.3/$compile/multidir?p0=ionRefresher&p1=&p2=ionRefresher&p3=%20(module%3A<ion-nav-view name="menuContent" class="view-container" nav-view-transition="ios">tarter.controllers)&p4=template&p5=%3Cdiv%class%3D%scroll-refresher%invisible%22%20collection-repeat-ignore%3D%22%22%20pulling-text%3D%22%22%20refreshing-text%3D%22%22%20refreshing-icon%3D%22%22%20pulling-icon%3D%22%22%on-refresh%3D%changeSlide()%22%3E 
    at REGEX_STRING_REGEXP (http://localhost:8100/lib/ionic/js/ionic.bundle.js:8895:12) 
    at assertNoDuplicate (http://localhost:8100/lib/ionic/js/ionic.bundle.js:17251:15) 
    at applyDirectivesToNode (http://localhost:8100/lib/ionic/js/ionic.bundle.js:16689:11) 
    at compileNodes (http://localhost:8100/lib/ionic/js/ionic.bundle.js:16286:15) 
    at compileNodes (http://localhost:8100/lib/ionic/js/ionic.bundle.js:16298:15) 
    at compileNodes (http://localhost:8100/lib/ionic/js/ionic.bundle.js:16298:15) 
    at compileNodes (http://localhost:8100/lib/ionic/js/ionic.bundle.js:16298:15) 
    at compile (http://localhost:8100/lib/ionic/js/ionic.bundle.js:16193:15) 
    at IonicModule.controller.self.appendViewElement (http://localhost:8100/lib/ionic/js/ionic.bundle.js:52247:18) 
    at Object.IonicModule.factory.ionicViewSwitcher.create.switcher.render (http://localhost:8100/lib/ionic/js/ionic.bundle.js:50449:41)(anonymous function) @ ionic.bundle.js:21157ident.$get @ ionic.bundle.js:17936invokeLinkFn @ ionic.bundle.js:17479nodeLinkFn @ ionic.bundle.js:16977compositeLinkFn @ ionic.bundle.js:16368nodeLinkFn @ ionic.bundle.js:16972compositeLinkFn @ ionic.bundle.js:16368nodeLinkFn @ ionic.bundle.js:16972compositeLinkFn @ ionic.bundle.js:16368publicLinkFn @ ionic.bundle.js:16243IonicModule.controller.self.appendViewElement @ ionic.bundle.js:52259IonicModule.factory.ionicViewSwitcher.create.switcher.render @ ionic.bundle.js:50449IonicModule.factory.ionicViewSwitcher.create.switcher.init @ ionic.bundle.js:50369IonicModule.controller.self.render @ ionic.bundle.js:52115IonicModule.controller.self.register @ ionic.bundle.js:52073updateView @ ionic.bundle.js:57485(anonymous function) @ ionic.bundle.js:57462parent.$get.Scope.$broadcast @ ionic.bundle.js:24992$state.transitionTo.$state.transition.resolved.then.$state.transition @ ionic.bundle.js:44836processQueue @ ionic.bundle.js:23394(anonymous function) @ ionic.bundle.js:23410parent.$get.Scope.$eval @ ionic.bundle.js:24673parent.$get.Scope.$digest @ ionic.bundle.js:24484parent.$get.Scope.$apply @ ionic.bundle.js:24778done @ ionic.bundle.js:19191completeRequest @ ionic.bundle.js:19363requestLoaded @ ionic.bundle.js:19304 

請問我能得到一些關於這方面的指導嗎?

+0

您正在收到的問題是由您在自己的模塊中定義自己的ionRefresher指令引起的。如果你想覆蓋現有的指令(我建議不要),你需要在離子模塊 – thomaux

+0

上這樣做,我基本上只是想擴展它。我想讓離子複習的一切都減去它的模板。我不介意用自定義指令替換它,或者我應該說我寧願更喜歡,如果我能像離子複習那樣得到它的工作方式。 –

+0

@Anzeo:我應該怎麼做? –

回答

3

無需自定義指令,只需設置spinnernone即可禁用微調器或圖標。

<ion-refresher 
    spinner="none" 
    on-refresh="changeSlide()"> 
</ion-refresher> 
+0

但是這不會擺脫藍色背景? –

+0

我不知道你的藍色背景是從哪裏來的。只需將'spinner'設置爲none並避免任何類型的定製,並刪除您正在編寫的指令。請參閱http://play.ionic.io/app/2acaf5a7d302 –

+0

如果它解決了您的問題,請將其標記爲已接受。 –

0

我的兩分錢:使用飛旋= 「」 用來特羅以下異常:

spinner error on ionic framework when using spinner =""

當我切換到:

<ion-refresher on-refresh="doRefresh(false, true)" ng-if="search.canBeLoaded" refreshing-icon=""> 

,並添加下面的CSS規則:

ion-infinite-scroll .spinner { 
    display: none; 
} 

來自無限加載和刷新的旋轉器都不會按需顯示。 希望它有幫助。

0

add style.css

.loading-container .loading {background-color:black; } .spinner svg {stroke:#88C931;填寫:#88C931; }

+1

請您的解決方案添加描述 – user7294900

+0

添加的style.css .loading容器.loading {背景色:黑色;} .spinner SVG {行程:#88C931;填寫:#88C931;} –

+0

用此評論編輯您的答案 – user7294900