index.html
<body ng-app="myApp" ng-controller="myCtrl">
<div view-users id="viewuserdiv"></div>
</body>
Here is the angular js code to load the another html page into the div of id viewuserdiv.
var app = angular.module('myApp',[]);
app.directive('viewUsers',function(){
return{
templateUrl:"viewuser.html"
}
});
here is my viewuser.html
<table>
<thead>
<td>User Name</td>
<td>Mobile Number</td>
<td>Action</td>
</thead>
<tbody>
<td>Sam</td>
<td>4562147554</td>
<td><input type="button" value="View" id="updateUser" name="updateUser"></td>
</tbody>
</table>
Now after view is loaded i need to load another view i.e; update.php when "updateUser" button is clicked without refreshing the page.
update.php
<form action ="" method="POST">
User Name:<input type="text" id="uname" name="uname"/>
Mobile Number:<input type="text" id="uname" name="uname"/>
<input type="button" name="updatebtn" id="updatebtn" value="Update"/>
</form>
Is there is any way to do it by custom directives itself.