mardi 5 mai 2015

Angular module won't display data

Pretty new to angular so forgive me. I am trying to work with chart.js to display some data I am pulling off of a webservice. I have tested that the $http.get() works by putting the data in a table, plus console logs. The issue I am having is when using these chart js templates the data is always in the html, obviously I wanted to put it in a js file. So I included the ng-app and ng-controller but it still wont work:

<html>

  <head>
    <script data-require="jquery@*" data-semver="2.1.3" src="http://ift.tt/16ygW8q"></script>
    <script data-require="angular.js@*" data-semver="2.0.0-alpha.20" src="http://ift.tt/1DRvsRh"></script>
    <script data-require="chart.js@*" data-semver="0.2.0" src="//cdnjs.cloudflare.com/ajax/libs/Chart.js/0.2.0/Chart.js"></script>
    <link rel="stylesheet" href="style.css" />
    <script src="script.js"></script>
  </head>

  <body ng-app="myapp" ng-controller="MainCtrl">
    <div id="canvas-holder">
            <canvas id="chart-area" width="500" height="500"></canvas>
        </div>
        <button id="randomizeData">Randomize Data</button>

  </body>

</html>

There isn't much to the html, which Is why I am wondering why it isn't working?

I made a plunker with everything and it worked up until I added the angular.module().controller() stuff. Any ideas? Thanks.

Aucun commentaire:

Enregistrer un commentaire