Reputation: 2443
I have started using AngularJs and I need some help with controller model data sharing.
I have this html template:
<input ng-model="form.search">
I know that you can pass it with a function like FormCtrl.data(form.search)
. However I would like to know if there are other ways getting model data in controller.
Upvotes: 0
Views: 52
Reputation: 1776
You can access any model data in your Controller, e.g. console.log($scope.form.search)
will have it printed. You may also want to ng-init
the the form at the beginning of your controller code: $scope.form = {}
, before console.log($scope.form.search)
is invoked.
Upvotes: 1