普通のjavascript関数display(str)
をng-if
にコールしたいと思います。この機能は、あなたがこのようなあなたのapp.runモジュールにグローバル関数を作ることができ、コントローラコントローラ範囲外のng-ifからjavascript関数を呼び出す方法AngularJS
HTML
<body ng-app="myApp">
<div id="mycntrl" ng-controller="mainController">
<select id="selectid1" name="selectid1" ng-model="angularselect">
<option ng-value=""></option>
<option ng-value="val1">Value 1</option>
<option ng-value="val2">Value 2</option>
</select> Value : {{angularselect}}
<div ng-if="display(angularselect) === true">
<p>
Returned true
</p>
</div>
</div>
</body>
JS
var myApp = angular.module('myApp',[]);
myApp.controller('mainController',function($scope){
});
function display(str)
{
console.log('Javascript function called with argument '+str);
return true;
}