I'm newbie in angular JS. I have already follow the instructions.
First I'm using ng-init directive to search data. I still using static data for this case. Before I jump into combining it with laravel. I need to know the basic function in angular.
Everything run smooth. But when i change it into ng-controller, and access static data from scope, all i got is error.
This is my source code :
html :
<div ng-controller="DataPeople">
<input type='text' ng-model="search" >
<ul>
<li ng-repeat="lon in listofname | filter:search">
name : {{ lon.name }} | city : {{ lon.city }}
</li>
</ul>
</div>
javascript :
function DataPeople($scope) {
$scope.listofname = [
{name:'guta', city:'tangerang selatan'},
{name:'john', city:'jakarta utara'},
{name: 'oki', city:'singapura'},
{name: 'billy', city:'singapura'},
{name: 'george', city:'bandung'}
];
}
Uncaught SyntaxError: Unexpected token : http://errors.angularjs.org/1.5.0/ng/areq?p0=DataPeople&p1=not%20a%20function%2C%20got%20undefined
ohya this up on my fiddle too. http://jsfiddle.net/dq8r196v/3/
Hope you guys can help me.
Thanks a lot.