【发布时间】:2017-10-15 12:32:28
【问题描述】:
我有一个使用 jQuery 和 Flip 插件的组件,主要问题是当我尝试在 ngAfterViewInit 中使用它时,它根本不起作用,但也没有从日志中得到任何错误,是否有一个步骤我忘记了,所以我可以使用翻转插件?
这是我目前的代码,希望你们能帮助我,感谢你们的时间
import { Component, OnInit ,AfterViewInit} from '@angular/core';
import {ApiBackEndService} from '../api-back-end.service';
import { DatePipe } from '@angular/common';
import * as moment from 'moment';
declare var $ : any;
declare var flip : any;
@Component({
selector: 'app-booking',
templateUrl: './booking.component.html',
styleUrls: ['./booking.component.css']
})
export class BookingComponent implements OnInit , AfterViewInit{
...
constructor(private api:ApiBackEndService) { }
ngAfterViewInit(){
$(".flip").flip({
axis: 'y',
trigger: 'hover'
});
}
ngOnInit() {
this.api.loadRooms().subscribe(data=>{
this.rooms= data.rooms;
});
}
...
}
jQuery 版本 3.*
【问题讨论】:
标签: javascript jquery angular plugins jquery-plugins