Greetings,
I have the following in my dashboard folder
dashboard.controller.js
dashboard.html
the controller gets data from a dataservice.js which fetches data from sql
server via express.js api
I would like the scope of the directive to be fed with the data from my
controller namely $scope.d3data or vm.virtstats
Then how do I tie this in with my view dashboard.html. I have been
struggling with this for days. Thank you
<bar-chart height="options.height" data="data"></bar-chart>
(function () {
'use strict';
angular
.module('app.dashboard')
.controller('Dashboard', Dashboard)
.directive('barChart', function () { // Angular Directive
return {
restrict: 'E',
replace: true,
scope: {data: '=data'},
function Dashboard($state, $scope, dataservice, logger) {
var vm = this;
vm.deptvirts = [];
vm.virtstats = [];
$scope.d3data = null;
//more code here abbreviated
$scope.getVirtStatsData = function () {
return dataservice.getVirtStatsData().then(function (data) {
vm.virtstats = [];
vm.virtstats = data;
$scope.d3data = data;
return vm.virtstats;
});
};
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.