Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Directive fails on Angularjs v1.2.2 #8

Closed
neojay83 opened this issue Dec 27, 2013 · 4 comments
Closed

Directive fails on Angularjs v1.2.2 #8

neojay83 opened this issue Dec 27, 2013 · 4 comments

Comments

@neojay83
Copy link

Directive scope binding fails on AngularJS v1.2.2.

Scope.acData, scope.acChart and scope.acConfig are all undefined

Been reading about the failures and looks to be an async issue due to promise returned instead of actual data.

Html:-

Controller:-

function TestController($scope, $http) {
$scope.chart = {
series: ['Sales', 'Income', 'Expense'],
data: [{
x: "Jack",
y: [100, 210, 384],
tooltip: "this is tooltip"
},
{
x: "John",
y: [300, 289, 456]
},
{
x: "Stacy",
y: [351, 170, 255]
},
{
x: "Luke",
y: [54, 341, 879]
}]
};
$scope.config = {
labels: false,
title: "Savings",
legend: {
display: true,
position: 'right'
},
};

@chinmaymk
Copy link
Owner

I think a JSFiddle would help here. Could you try reproducing this issue on JSFiddle and post the link ?

Thanks

@neojay83
Copy link
Author

I created a plunk for this issue. You can view the same here. http://plnkr.co/edit/0b08un1Emxk6cZG4kCyj?p=preview

@chinmaymk
Copy link
Owner

The problem is with data-ac-chart. As per the config it takes an attribute, not a value.

When you say data-ac-chart="bar" angular-charts will try to find $scope.bar i.e. a property inside your controller. I would recommend using the property rather than direct value so you can change chart type easily. However, if you need to keep it a constant and changing chart types is not required, you should pass it enclosed in single quotes like this

data-ac-chart="'bar'"

I've updated the plunker, it works fine now: http://plnkr.co/edit/3jqFwQnvLCSPNFp8epQL?p=preview

Hope this helps.

@neojay83
Copy link
Author

Thanks man...It works. Sillly me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants