我是AngualrJS世界的新手,之后解释了如何将JQuery Slider插件转换为自定义指令,以便它在AngularJS中起作用
目前,jquery是id'tave-wrap'
的触发器<div id="camera_wrap" >
.......image content etc.....
</div>
然后是函数
<script type="text/javascript">
function startCamera()
{ $('#camera_wrap').camera(
{ fx:'random', time: 2000, loader: 'none', playPause: false, height: '65%',
pagination: true }); } $(function () { startCamera() });
</script>
任何帮助非常感谢!
由于 标记
答案 0 :(得分:4)
我可能只是将它包装在一个指令中:
<div id="camera_wrap" camera-plugin>
指令
app.directive("cameraPlugin", [function() {
return {
restrict: "A",
link: function(scope, elem, attrs) {
$(elem).camera({
fx:'random',
time: 2000,
loader: 'none',
playPause: false,
height: '65%',
pagination: true
});
startCamera(); //wherever this is defined?
}
}
}]);