I want to use input fId value in angular controller FollowBtnCtrl, i made a button which called the followMe() function, defined inside the FollowBtnCtrl controller, when i am getting $scope.fId value inside the controller its showing undefined value. Please check my code and tell me where i am wrong, Sorry for this silly question but i am new in angularjs. Thanks in advance
angular controller:
.controller("FollowBtnCtrl", function ($scope) {
$scope.followMe = function () {
alert($scope.fId);
}
});
Html code:
<div ng-controller="FollowBtnCtrl">
<ons-toolbar-button>
<input ng-model="fId" id="fId" type="hidden" value="10" />
<button ng-click="followMe()" class="followButton button button">
Hello
</button>
</ons-toolbar-button>
</div>
ng-model="fId"has no value assigned! Try this jsfiddle.net/6a9usr8wvalueasmodelvalue..