javascript - Angular html directive execution -


i'm building web application that's fetching data backend. right html code looks this:

<div ng-app="app" ng-controller="controller">      <form ng-submit="getvalues()">         <div>             <button type="submit">select</button>         </div>     </form>      <plot-chart value="data"></plot-chart>  </div> 

and javascript code looks this:

angular.module('app', []) .controller('controller', function controller ($scope, $http) {      $scope.getvalues = function () {         //value getter when submit pressed          $http({             method: 'get',             url:"some_url_here" +                  "some_param" +                 $scope.some_param.some_id +                 '&other_param=' +                 $scope.other_param.other_id +                 '&group=' +  some_group_id         }).success(function (data) {             $scope.data = data;              if($scope.data == "null"){                 $scope.error = data.message;                 // clear data part                 $scope.data = '';                 return;             }              // clear error messages             $scope.error = '';         }).error(function (data) {             $scope.error = data.message;             // clear data part             $scope.data = '';             return;         });      };  });  .directive("plotchart", function (data) {     //graphing values d3.js got getter above  }); 

i want html document call on "makeprettygraph" directive , first clear old graph , plot new graph on page when submit form, i'm lost how make html this.

so question following: code need implement make html document "makeprettygraph"-directive when submit button pressed? how "connect" button action draws graph?

i solved it. matter of directive naming - it's supposed named makeprettygraph in angular code, whilst in html code it's make-pretty-graph.

it executes fine, val="data" , correctly plots graph.


Comments