自定义角度指令未在离子导航栏中显示(Custom AngularJS directive not showing in Ionic nav bar)
我有离子导航栏,里面有两个离子导航按钮和一个自定义角度指令(header-logo-dropdown)。 当我进行路由或更改浏览器窗口大小时,自定义指令有时不显示,所以我有两个问题:
1)在离子导航栏中包含自定义HTML和指令的正确方法是什么?
2)我写的代码有什么问题?
<ion-pane ion-side-menu-content drag-content="false"> <ion-nav-bar show-when="(max-width:767px)" class="bar bar-header bar-light header-nav-container"> <ion-nav-buttons side="left" id="button--menu"> <button menu-toggle="left" class="button button-icon icon ion-navicon-round" show-when="(max-width:767px)"></button> </ion-nav-buttons> <div class="title header-logo-container"> <header-logo-dropdown></header-logo-dropdown> </div> <ion-nav-buttons side="right"> <a class="button bar-header__iconprofile" href="#/user"><i class="icon iconSilver profile item-silver"></i> </a> </ion-nav-buttons> </ion-nav-bar> <ion-view> <ion-nav-view animation="slide-left-right"> </ion-nav-view> </ion-view> </ion-pane>
I have ion-nav-bar and there are two ion-nav-buttons and one custom Angular directive inside (header-logo-dropdown). When I am doing routing or changing browser window size, the custom directive is not showing sometimes, so I have two questions about this:
1) What is the proper method to include custom HTML and directive in ion-nav-bar?
2) What is wrong with the code I've written?
<ion-pane ion-side-menu-content drag-content="false"> <ion-nav-bar show-when="(max-width:767px)" class="bar bar-header bar-light header-nav-container"> <ion-nav-buttons side="left" id="button--menu"> <button menu-toggle="left" class="button button-icon icon ion-navicon-round" show-when="(max-width:767px)"></button> </ion-nav-buttons> <div class="title header-logo-container"> <header-logo-dropdown></header-logo-dropdown> </div> <ion-nav-buttons side="right"> <a class="button bar-header__iconprofile" href="#/user"><i class="icon iconSilver profile item-silver"></i> </a> </ion-nav-buttons> </ion-nav-bar> <ion-view> <ion-nav-view animation="slide-left-right"> </ion-nav-view> </ion-view> </ion-pane>
原文:https://stackoverflow.com/questions/37009511
最满意答案
我找到了! 您必须将Stylus.IsPressAndHoldEnabled设置为false才能在按下手指时获取TouchDown事件(而不是提起它)。
I found it! You must set Stylus.IsPressAndHoldEnabled to false to get the TouchDown event when pressing the finger (without lifting it).
相关问答
更多-
无法通过CSS禁用鼠标事件。 但是您可以使用javascript轻松完成: 使用Modernizr检查触摸支持或只是查看有关触摸检测的讨论如何在JavaScript中检测设备触摸支持? 如果不支持触摸事件,请应用CSS类(您之前创建的)或直接在要忽略指针事件的所有元素上添加CSS规则。 There is no way to disable only mouse events through CSS. But you can easily do it with javascript: Check touch ...
-
有没有办法在移动设备上使用鼠标事件作为触摸事件?(Is there a way to use mouse events as touch events on a mobile device?)[2021-07-18]
您想使用以下内容: - touchstart •动作:触摸屏幕时触发(也会触发多点触摸) •等效: mousedown - touchend •动作:手指从屏幕上抬起时触发 •等效: mouseup - touchmove •动作:当一个或多个手指在屏幕上移动时触发 •等效: mousemove - touchcancel •操作:系统取消触摸事件时 •等效: mouseleave 更新小提琴 You want to use the following: -touchstart •Action: fires ... -
我相信这是你想要的: function touchHandler(event) { var touches = event.changedTouches, first = touches[0], type = ""; switch(event.type) { case "touchstart": type = "mousedown"; break; case "touchmove": type = "mousemove ...
-
JS:如何识别是否通过触摸(而非鼠标)提供鼠标事件(JS: How to recognise if a mouse event is provided by touch (not mouse))[2023-05-28]
解决方案: 防止touchstart中的默认值: $key.on("touchstart", function (e) { e.preventDefault(); }); 然后不会调用鼠标事件。 The solution: Prevent default in the touchstart: $key.on("touchstart", function (e) { e.preventDefault(); }); Then the mouse events won't be called. ... -
这里真的没有足够的信息来开始回答这个问题。 想到的最明显的答案是你的一些qml文件没有正确定义qml中的TouchArea。 如果您需要更多帮助,则需要发布代码。 I tried using the EG-Touch touch drivers for my platform, which are supposed to have some issues on 12.04(as per some forums). I reverted back to Ubuntu 11.04 and used the e- ...
-
你可以像这样映射它: $('#drawingCanvas').bind("mousedown touchstart", function(e){ $('#drawingCanvas').bind("mousemove touchmove", function(e){ $('#drawingCanvas').bind("mouseup touchend", function(e){ 并且如果需要的话,微调代码。 You can map it like this: $('#drawingCanvas'). ...
-
是的,至少在iPad上。 我去年在我的应用程序的HTML5(又名DHTML)模式下运行OpenLaszlo 4.9.0的iPad2上进行了测试,用于研发目的,以下内容已确认可用: 1)在OpenLaszlo HTML5模式下触摸应用程序屏幕上的按钮,正确触发按钮的onclick事件。 2)在OpenLaszlo中用手指在触摸屏上拖放HTML5模式与在非触摸屏系统上使用鼠标拖放具有相同的结果。 注意:这仅在iPad2上测试过,未在Android,Windows Phone,Blackberry等上测试过。 Y ...
-
处理鼠标和触摸事件(Handling mouse and touch events)[2022-03-07]
我找到了! 您必须将Stylus.IsPressAndHoldEnabled设置为false才能在按下手指时获取TouchDown事件(而不是提起它)。 I found it! You must set Stylus.IsPressAndHoldEnabled to false to get the TouchDown event when pressing the finger (without lifting it). -
如果需要,您可以深入了解Microsoft Surface SDK 2.0。 这些组件包括针对触摸屏进行了优化的控件,但它们还允许鼠标光标作为单个触摸点运行。 例如,我正在使用SurfaceListBox并单击并拖动任何项目允许我滚动。 它也具有动量和弹性,使其自然运动。 这是Surface SDK 2.0的下载链接: http : //www.microsoft.com/download/en/details.aspx?id = 266716 If you want, you can dig into M ...
-
没有必要,如果您只需要跟踪1“输入/手指”,您可以使用MouseEvents。 已创建TouchEvents以同时处理多个“输入”。 No is not necessary, if you need only to track 1 "input/finger" at time you can use MouseEvents. TouchEvents have been created to handle multiple "input" at the same time.