I am trying to use angular's ng-model to store it's value and using ng-click to pass the values to the controller. With my current code, I am always receiving undefined value. What have I done wrong?
HTML
<ion-content>
<div class="list">
<label class="item item-input">
<textarea ng-model="feed.status"></textarea>
</label>
</div>
</ion-content>
<div class="tabs tabs-icon-left">
<a class="tab-item" ng-click="post(feed)">
<i class="icon ion-arrow-right-b"></i>
</a>
</div>
JavaScript - Controller
.controller("PostController", function($scope, $http, $localStorage, $location){
$http.get("https://graph.facebook.com/v2.2/me", { params: { access_token: $localStorage.accessToken, fields: "id, location, picture", format: "json" }}).then(function(result) {
$scope.profileData = result.data;
console.log( result.data);
}, function(error) {
alert("There is a problem with your profile");
console.log(error);
});
$scope.post = function(data){
console.log(data);
}
});
Routes
.config(function($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/feeds')
$stateProvider
.state('login', {
url: '/',
templateUrl: 'templates/login.html',
controller: 'LoginController'
})
.state('profile', {
url: '/profile',
templateUrl: 'templates/profile.html',
controller: 'ProfileController'
})
.state('feeds', {
url: '/feeds',
templateUrl: 'templates/feeds.html',
controller: 'FeedsController'
})
.state('post', {
url: '/post',
templateUrl: 'templates/post.html',
controller: 'PostController'
})
})