我可以将离子卡弹出

时间:2018-08-22 08:31:03

标签: ionic-framework

我希望用离子显示星级,为此,我找到了一些代码。但是使用此方法,我用离子卡获得星级 在html中,我希望它像警报一样工作?是否可以将html绑定到警报或以任何方式弹出离子卡

这是我的app.module.ts

// A.java
class A {
    @Transactional(rollbackFor = Exception.class)
    public void aMethod() {
        B b = new B();
        b.bMethod("111", true); // record of "111" has been created
        b.bMethod("222", true); // record of "222" has been created
        createRecordInDB("333"); // record of "333" has been rolled back and NOT created
        throw new Exception("Throw exception explicitly!");
    }
}

// B.java
class B {
    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
    public void bMethod(String id, bool success) {
        createRecordInDB(id);
        if (!success) {
            throw new Exception("Throw exception explicitly!");
        }
    }
}

这是我的home.html

 import { BrowserModule } from '@angular/platform-browser';
 import { ErrorHandler, NgModule } from '@angular/core';
 import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
 import { SplashScreen } from '@ionic-native/splash-screen'; 
 import { StatusBar } from '@ionic-native/status-bar';
 import { Ionic2RatingModule } from 'ionic2-rating';
 import { MyApp } from './app.component';
 import { HomePage } from '../pages/home/home';

  @NgModule({
    declarations: [
    MyApp,
    HomePage
  ],
 imports: [
  BrowserModule,
  Ionic2RatingModule,
   IonicModule.forRoot(MyApp)
 ],
bootstrap: [IonicApp],
entryComponents: [
 MyApp,
HomePage
],
providers: [
StatusBar,
SplashScreen,
{provide: ErrorHandler, useClass: IonicErrorHandler}
]
})
export class AppModule {}

这是我的home.scss文件

   <ion-header>
  <ion-navbar>
       <ion-title>
        Ionic Blank
      </ion-title>
    </ion-navbar>
</ion-header>
 <ion-content>
    <ion-card padding>
      <rating [(ngModel)]="rate" max="5" emptyStarIconName="star-outline"   
       halfStarIconName="star-half"     starIconName="star"  
       nullable="false"  (ngModelChange)="onModelChange($event)">
     </rating>
     <h2>{{rate}}</h2>
  </ion-card>
   </ion-content>

这是我的家。

  page-home {
     ul {
     padding: 10px;
      &.rating li {
      padding: 5px 10px !important;
      background: none;
     color: #ffb400;
      ion-icon {
        font-size: 40px;
      }
    }
   }
  }

0 个答案:

没有答案