<div class="page-header">
|
<h1>Intro</h1>
|
</div>
|
|
<div class="row">
|
|
<div class="col col-lg-6">
|
<div style="margin-top: 20px">
|
<h3>Steps for getting started (example on right)</h3>
|
<ol>
|
<li>Add references to <a href="http://angularjs.org/" target="_blank">AngularJS</a>. EG:<br/>
|
<pre style="margin-top:10px" data-prettycode pretty-lang="html">
|
<script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.2/angular.js"></script>
|
</pre>
|
</li>
|
<li>Add references to <a href="https://github.com/esvit/ng-table/">ngTable</a>'s javascript and css files. EG:<br/>
|
<pre style="margin-top:10px" data-prettycode pretty-lang="html">
|
<link rel="stylesheet" href="https://cdn.rawgit.com/esvit/ng-table/v1.0.0/dist/ng-table.min.css">
|
<script src="https://cdn.rawgit.com/esvit/ng-table/v1.0.0/dist/ng-table.js"></script>
|
</pre></li>
|
<li>Where you declare your app module, add <code>ngTable</code>:<br>
|
<pre style="margin-top:10px" data-prettycode pretty-lang="js">
|
angular.module("myApp", ["ngTable"]);
|
</pre>
|
</li>
|
<li>In your html file within the controller where you plan to use <code>ng-table</code>, add:<br>
|
<pre style="margin-top:10px" data-prettycode pretty-lang="html">
|
<table ng-table="vm.tableParams" class="table" show-filter="true">
|
<tr ng-repeat="user in $data">
|
<td title="'Name'" filter="{ name: 'text'}" sortable="'name'">
|
{{user.name}}</td>
|
<td title="'Age'" filter="{ age: 'number'}" sortable="'age'">
|
{{user.age}}</td>
|
</tr>
|
</table>
|
</pre>
|
</li>
|
<li>In your javascript file within the controller where you plan to use <code>ng-table</code>, declare:<br> </li>
|
<pre style="margin-top:10px" data-prettycode pretty-lang="js">
|
var self = this;
|
var data = [{name: "Moroni", age: 50} /*,*/];
|
self.tableParams = new NgTableParams({}, { dataset: data});
|
</pre>
|
</ol>
|
</div>
|
</div>
|
<div class="col col-lg-6">
|
|
<h3>Example</h3>
|
<div>
|
|
<table ng-table="vm.tableParams" class="table" show-filter="true">
|
<tr ng-repeat="user in $data">
|
<td title="'Name'" filter="{ name: 'text'}" sortable="'name'">
|
{{user.name}}
|
</td>
|
<td title="'Age'" filter="{ age: 'number'}" sortable="'age'">
|
{{user.age}}
|
</td>
|
</tr>
|
</table>
|
</div>
|
|
</div>
|
|
</div>
|