如何创建我的情况下弹出链接? [英] How to create a popup link in my case?

查看:139
本文介绍了如何创建我的情况下弹出链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用的角度我的情况下打开一个弹出式窗口。

I am trying to use angular to open an popup window in my case.

我有这样的事情

 <a ng-href = "window.open('{{videoLink}}')" >open a video</a>

这让我对未找到错误的浏览器。

It gave me 'Not found' error in browser.

不过,这将打开一个视频,但它在浏览器中的另一个选项卡。

However, this will open a video but it's in another tab in browser.

 <a ng-href = {{videoLink}}>open a video</a>

如何在弹出成功地打开我的视频。

How do I open my video successfully in popup.

谢谢!

推荐答案

使用 NG-点击就像在你的 previous问题

您的问题是, NG-点击需要一个AngularJS前pression。请参阅: https://docs.angularjs.org/guide/ex$p$pssion

Your problem was that ng-click takes an AngularJS expression. See: https://docs.angularjs.org/guide/expression

如果你想运行更复杂的JavaScript code,你应该让一个控制器的方法,并呼吁从视图中的方法。

"If you want to run more complex JavaScript code, you should make it a controller method and call the method from your view."

因此​​,只要通过 $范围控制器为元素,并调用它的函数NG点击=clickHander()

So just set a function in the $scope of the controller for that element and call it through ng-click="clickHander()".

如果这没有帮助,你需要发布更多code(preferably中的jsfiddle或类似的东西)。

If this doesn't help, you need to post more code (preferably in JSFiddle or something like).

这篇关于如何创建我的情况下弹出链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆