Call functions in scope
Description
The following code shows how to Call functions in scope.
Example
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"></script>
<script type='text/javascript'>
function Controller($scope) {<!--from ww w . jav a 2s . c o m-->
$scope.data = ["someText"];
$scope.getIndex=function(){
return "0";
};
}
</script>
</head>
<body>
<div ng-app ng-controller="Controller">
<p ng-init="index=getIndex()"</p>
<input ng-model="data[index]"/>
</div>
</body>
</html>