Why doesn't this work?
<a ng-click="if(item.lp_iframe=='') ? href='{{item.lp_url}}' :
playVideo(item.lp_iframe_id)" target="_blank">
I suspect I have to escape the ''
??
Why doesn't this work?
<a ng-click="if(item.lp_iframe=='') ? href='{{item.lp_url}}' :
playVideo(item.lp_iframe_id)" target="_blank">
I suspect I have to escape the ''
??
move this to a function in scope, like this
$scope.foo = function() {
// ...
}
ng-click="foo()"
According to the doc.
ng-click="expression"
Expression doesn't mean javascript, see http://docs.angularjs.org/guide/expression.
Your problem is, your expression look like
<a>ng-click="href='url'"></a>
// is the syntax is correct? Not
So try this
<a ng-click="if(item.lp_iframe=='') ? redirect(item.lp_url) :
playVideo(item.lp_iframe_id)" target="_blank">
$scope.redirect= function(url) {
window.open(url)
}
or,
Try this
<a ng-click="clickevent()" target="_blank">
$scope.clickevent= function() {
if(item.lp_iframe=='')
{
window.open(url)
}
playVideo(item.lp_iframe_id)
}