ashish-chopra / angular-gauge

A reusable gauge directive for Angular 1.x apps and dashboards
https://ashish-chopra.github.io/angular-gauge/
MIT License
95 stars 36 forks source link

inserting json fetched values to value attribute #18

Closed Kudla161992 closed 7 years ago

Kudla161992 commented 8 years ago

how to insert values that are fetched from json to value attribute of ng-guage.

for example:

{{item.l1.open}}

Overdue
ashish-chopra commented 8 years ago

Hey @akshayallu64, you can simply supply any object to value attribute as shown below:

// inside your controller
function myController() {
    var vm = this;
     vm.currentValue = 10;
}

// inside html
<div ng-controller="myController as main">
<ng-gauge size="100" type="full" thick="8" value="main.currentValue" 
cap="round"  foreground-color="black" 
background-color="rgba(0,0,0, 0.4)" append="Tickets">
</div>

if you remove () from the code you metioned, then item.l1.open will be data bind to the value attribute of gauge. Assuming that this variable item is accessible at HTML via controller.

<ng-gauge size="100" type="full" thick="8" value="item.l1.open" 
cap="round"  foreground-color="black" 
background-color="rgba(0,0,0, 0.4)" append="Tickets">
ashish-chopra commented 7 years ago

Hi @akshayallu64 incase you need to see a working example of the query you asked, check out the new website for the library at https://ashish-chopra.github.io/angular-gauge/ in Demos section.