Yesterday I start learning AngularJs
online. I decided to create some useful stuffs for my new project using Angular
. Below is some portion of my hard work :
The HTML Part
<div data-ng-controller="DataGrid_Controller">
<table class="table table-stripped">
<thead>
<tr>
<th data-field="fname"> First Name </th>
<th data-field="lname"> Last Name </th>
<th data-field="email"> Email </th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
The Angular Part
<script type="text/javascript">
var app = angular.module('TestApp',[]);
app.controller('DataGrid_Controller', function($scope){
//var fields = ['fname', 'lname', 'email'];
//How can I get the value of data-field attributes in my 'Controller' so that I could use them
})
</script>
How can I get the value of data-attributes
from child elements (I don't know either the term element
exists or not in angular?) in my controller.
I am 1 day old baby for AngularJs
so please show me the right way if you think I am catching the wrong way of doing it. I have used jQuery
for years so I am thinking a controller
as plugin
. Please help me solving the problem.
{{ user.firstName }}
(for example) to display the user first name. – JB Nizet Nov 17 '13 at 11:06datagrids
? An example code will be helpful because I am not going to understand until I get it working. Sorry for my childish behavior. – Lekhnath Nov 17 '13 at 11:15datagrids
, then what logic that controleer should realize? – Alexei Nov 17 '13 at 11:32