var ParentController = function ( ) { this.MyEvent = function () { alert('foo-bar'); }; this.AddHTML= function () { $("#ButtonSec").html('<input type='button' ng-click='Parent.MyEvent()' value='inner button'/>'); }; }; angular.module('myApp', []).controller('ParentController', ParentController);
<div ng-app='testComponent'> <div id="content" ng-controller="ParentController as Parent"> <div id="ButtonSec"> <input type='button' ng-click='Parent.MyEvent()' value='inner button'/> </div> </div> </div>
<div ng-app='testComponent'> <div id="content" ng-controller="ParentController as Parent"> <div id="ButtonSec"> </div> </div> <input type='button' ng-click='Parent.AddHTML()' value='Add HTML'/> </div>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)