I have 2 buttons and 2 contenteditable div. When I click a button, I pass a parameter. Now in the controller, I have a $rootScope.$on() function which appends in the contenteditable div so I want to write $scope.paramter in the $rootScope.$on() method, and in place of parameter I want to put the value I passed as the parameter.
Example:
<button type="button" ng-click="open('textModel')">Emojis</button>
<div contenteditable="true" ng-model="textModel"></div>
<button type="button" class="btn btn-default" ng-click="open('textModel2')">Emojis</button>
<div contenteditable="true" ng-model="textModel2"></div>
//Inside controller
$rootScope.$on('selectedCode', function(event, args){
console.log(btnid); //btnid has the value textModel or textModel2 depending on the button clicked
$scope.btnid += 'Hello'; //I want that instead of btnid, textModel gets appended
});
Now in the controller I want to write it as $scope.textModel += 'Hello'; instead of $scope.parameter, So tht when I press first button, the contenteditable div with ng-model as textModel gets appended and when I press second button, the contenteditable div with ng-model as textModel2 gets appended
Please Help