I'm trying to edit an element in real time by triggering a function on ng-click with AngularJS.
Here's my html:
<div class="row question">{{questions.1.name}} <a href="" class="glyphicon glyphicon-pencil" ng-click="editQuestion(questions.1.name)"></a></div>
And the js:
function QuestionsMap($scope) {
$scope.questions = {
"1": {
"name": "Hello! Do you like to travel?",
"ID": "1",
"answer": {
"yes": {
"name": "Yes",
},
"no": {
"name": "No",
}
}
}
};
$scope.editQuestion = function (name) {
$scope.editing = $scope.questions[name];
};
}
What am I missing? Is the editQuestion function not properly written?