function
〜angularjs
directive
の構文解析は可能ですか?templateUrl
を返しますか?私の場合、私はこのdirective
angularjs関数のtemplateUrlディレクティブへの構文解析
.directive('forumForm', function(){
return {
restrict : 'C',
scope : {
data : '=forum',
},
templateUrl : '/templates/forum_form.tpl.html'
}
});
を持っているこれは私のtempalteUrl
<input type="text" ng-model="data.Title" name="nameF" class="form-control" required="" ng-minlength="20" ng-maxlength="100">
<input type="" class="tagsinput" ng-model="data.tagIn" />
<button type="button" ng-click="fn(data)">Submit</button>
あると、私はこの
<div class="forumForm" forum="forum"></div>
最終同様class
を経て、私のcontroller
と呼ばれる機能を持っていることを呼び出しますfn
$scope.fn = function((){
alert('text')
})
私は、変数を私のtemplateUrl
に構文解析した結果、directive
を見ることができます。私の問題は、そののfunction
を解析することは可能ですか?だから私は
<div class="forumForm" forum="forum" fn="action(forum)"></div>
を作成して、私は(私のtemplateUrl
で)button
をクリックした場合、それは私がcontroller
に書かれているfunction
を呼んだ。場合それは可能ですか?このため
ねえ、あなたは私の例を与えることができますか?私は角度の新しかった –
はい、私の答えを更新します:) –
@AdiSpartaは例をチェックアウトします。それが役に立てば幸い。 –