Hello I'm trying to get the input value but the result its blank. Can you help me?
**HTML:**
<input type="text" id="totalscore2" ng-model="10">
**JavaScript:**
angular.module('teB', [])
.controller('teBB', ['$scope', function($scope) {
let total = document.getElementById("totalscore2").value
console.log(total)
const options = {
series: [total],
chart: {
height: 350,
type: 'radialBar',
},
plotOptions: {
radialBar: {
hollow: {
size: '70%',
}
},
},
labels: ['Puntuación'],
}
let chart = new ApexCharts(document.querySelector("#charttest"), options)
chart.render()
}]);
I want to get the ng-model value to then show it in a chart
CodePudding user response:
You should use document.getElementById('totalscore2').getAtrribute('ng-model')
CodePudding user response:
First of all you have to write tag element like:
Here whatever the value in input field, "TotalScore" is the the scope variable which can be access in controller by $scope.TotalScope.