本文整理汇总了TypeScript中ng2-toastr.ToastsManager类的典型用法代码示例。如果您正苦于以下问题:TypeScript ToastsManager类的具体用法?TypeScript ToastsManager怎么用?TypeScript ToastsManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ToastsManager类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: showError
showError(ngToast: ToastsManager, objError, status){
if(objError !== null && typeof objError === 'object')
{
if('error_description' in objError)
ngToast.error(objError.error_description, 'Ops!');
else if('message' in objError){
if(status == 401 || status === undefined){
if(objError.message !== 'Authorization has been denied for this request.')
ngToast.error(objError.message, 'Ops!');
else{
ngToast.error('Sua sessão expirou ou o acesso foi negado. Faça o login novamente.', 'Ops!');
this.sessionService.logout();
this.router.navigate(['/login']);
}
}
else
ngToast.error(objError.message, 'Ops!');
}
else
ngToast.error(objError, 'Ops!');
}
else{
if(typeof objError === 'string')
ngToast.error(objError, 'Ops!');
else if(objError === null && status == -1)
ngToast.error('Não foi possível conectar-se ao servidor.', 'Ops!');
else
ngToast.error('Ocorreu um erro ao realizar esta operação. Contate o suporte.', 'Ops!');
}
}
开发者ID:PauloRobertoMoraesCosta,项目名称:Garcom,代码行数:30,代码来源:help.ts
示例2: constructor
constructor(private toastr: ToastsManager, vRef: ViewContainerRef,
public router: Router,
public cognitoLoginService: CognitoLoginService) {
this.toastr.setRootViewContainerRef(vRef);
}
开发者ID:BruceCutler,项目名称:aws-serverless-workshops,代码行数:7,代码来源:login.component.ts
示例3: saveEmergency
saveEmergency() {
if (this.formEmergency.valid) {
if (this.patients.length > 0) {
const emergency = {
date: this.formEmergency.get('date').value,
type_emergency: this.formEmergency.get('category').value,
driver: this.driverSelected,
ambulance: this.ambulanceSelected,
paramedic: this.paramedicsSelected,
patient: this.patients,
location: {
type: 'Point',
coordinates: this.positions
}
};
this.formEmergency.reset({
driver: '',
ambulance: '',
paramedics: ''
});
this._emergencyService.save(emergency).subscribe(
(res) => {
console.log(res.json());
},
(error) => {
console.log(error.json());
}
);
}else{
this._toast.info('Debe ingresar al menos un paciente', 'Emergencias!');
}
}else{
this._toast.info('Todos los campos marcados con * son obligatorios', 'Emergencias!');
}
}
开发者ID:manuelao-s4ds,项目名称:Emergencies-ui,代码行数:35,代码来源:emergency.component.ts
示例4:
}, error => {
if (error.status === 401) {
this._toastr.error('Невозможно войти с предоставленными данными', 'Ошибка!');
} else {
this._toastr.error('Что-то пошло не так', 'Ошибка!');
}
});
开发者ID:asiman161,项目名称:easy-tests,代码行数:7,代码来源:sign-in.component.ts
示例5: ngOnInit
ngOnInit(): void {
this.toastr.setRootViewContainerRef(this._vcr);
this.toastr.onClickToast().subscribe( toast => {
this.toastr.dismissToast(toast);
});
this._tokenService.init({
apiPath: 'api',
signInRedirect: 'auth'
});
}
开发者ID:asiman161,项目名称:easy-tests,代码行数:10,代码来源:app.component.ts
示例6: save
save() {
if (this.formParamedics.valid) {
const paramedic = {
name: this.formParamedics.get('name').value,
lastname: this.formParamedics.get('lastname').value,
phone: this.formParamedics.get('phone').value,
cellPhone: this.formParamedics.get('cellPhone').value,
gender: this.formParamedics.get('gender').value,
birthdate: this.formParamedics.get('birthdate').value,
specialization: this.formParamedics.get('specialization').value
};
this._paramedicsService.save(paramedic).subscribe(
(res) => {
this._toast.success(`Se registro el paramedico ${res.json().name}`, 'Paramedicos!');
this.formParamedics.reset({
gender: ''
})
},
(error) => {
console.log(error.json());
this._toast.error(`Ocurrio un error al registrar al paramedico`, 'Paramedicos!');
}
);
}else {
this._toast.info(`Todos los campos marcados con * son obligatorios`, 'Paramedicos!');
}
}
开发者ID:manuelao-s4ds,项目名称:Emergencies-ui,代码行数:28,代码来源:paramedics.component.ts
示例7: saveAmbulance
saveAmbulance() {
if (this.formAmbulance.valid) {
const ambulance = {
car: this.formAmbulance.get('car').value,
car_plate: this.formAmbulance.get('car_plate').value,
type_ambulance: this.formAmbulance.get('type_ambulance').value,
available: this.formAmbulance.get('available').value
};
this.formAmbulance.reset({
car: '',
car_plate: '',
type_ambulance: '',
available: ''
});
this._ambulanceService.save(ambulance).subscribe(
(res) => {
console.log(res.json());
},
(error) => {
console.log(error.json());
}
);
}else {
this._toast.info('Todos los campos marcados con * son obligatorios', 'Ambulancias!');
}
}
开发者ID:manuelao-s4ds,项目名称:Emergencies-ui,代码行数:26,代码来源:ambulances.component.ts
示例8: toastWarning
/*
* Displays a warning message
*/
toastWarning(reason?: string)
{
let key: string;
switch(reason)
{
case 'accessDenied':
key = 'TOASTR.WARNING.ACCESS';
break;
case 'noResult':
key = 'TOASTR.WARNING.TIMEOUT';
break;
case 'timeout':
key = 'TOASTR.WARNING.TIMEOUT';
break;
default:
key = 'TOASTR.WARNING.DEFAULT';
break;
}
let message: string;
this.translateService.get(key).subscribe(
value => {
message = value;
});
this.toastr.warning(message)
}
开发者ID:jodogne,项目名称:orthanc-explorer-2,代码行数:30,代码来源:app.component.ts
示例9: toastInfo
/*
* Displays an info message
*/
toastInfo(reason?: string)
{
let message: string;
let key: string;
switch(reason)
{
case 'jobRegistered':
key = 'TOASTR.INFO.JOB';
break;
case 'noResult':
key = 'TOASTR.INFO.NORESULT';
break;
case'restartNeeded':
key = 'TOASTR.INFO.RESTART';
break;
default:
key = 'TOASTR.INFO.DEFAULT';
break;
}
this.translateService.get(key).subscribe(
value => {
message = value;
});
this.toastr.info(message)
}
开发者ID:jodogne,项目名称:orthanc-explorer-2,代码行数:31,代码来源:app.component.ts
示例10: toastSetupError
/*
* Displays an error at setup
*/
toastSetupError(code :number)
{
let key: string;
switch(code)
{
case 1:
key = 'TOASTR.SETUP.SQLERROR';
break;
case 2:
key = 'TOASTR.SETUP.PATHERROR';
break;
case 4:
key = 'TOASTR.SETUP.USERERROR';
break;
case 5:
key = 'TOASTR.SETUP.USERERROR';
break;
case 6:
key = 'TOASTR.SETUP.SETERROR';
break;
default:
key = 'TOASTR.ERROR.DEFAULT';
}
let message: string
this.translateService.get(key).subscribe(
value => {
message = value;
});
this.toastr.error(message);
}
开发者ID:jodogne,项目名称:orthanc-explorer-2,代码行数:33,代码来源:app.component.ts
注:本文中的ng2-toastr.ToastsManager类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论