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

angular module: Move options into single attribute and provide it as json #47

Closed
mrzmyr opened this issue Oct 12, 2013 · 8 comments
Closed
Assignees
Milestone

Comments

@mrzmyr
Copy link
Collaborator

mrzmyr commented Oct 12, 2013

We should provide the options format for the angular module as JSON format in a separated attribute to be more conventional. That also will solve issues like referencing to variables (#44).

Example for easy-pie-chart:

<div 
    easypiehcart
    ng-options="{ barColor: '#ef1e25', trackColor': '#f2f2f2', 'scaleColor': '#dfe0e0', 'scaleLength': 5 }"
    ng-percent="percent"
></div>

A way better:

<div easypiechart ng-options="options" ng-percent="percent"></div>
var app = angular.module('app', ['easypiechart']);
app.controller('chartCtrl', ['$scope', function ($scope) {
    $scope.percent = 65;
    $scope.options = { 
        barColor: '#ef1e25', 
        trackColor: '#f2f2f2', 
        scaleColor: '#dfe0e0', 
        scaleLength: 5
    };
}]);

What do you think about it ?

@rendro
Copy link
Owner

rendro commented Oct 15, 2013

I appreciate this approach as we already discussed. Defining the options in a controller seems more convenient to me than the css-style version that has to be parsed when the module is initialized.

@alex6o
Copy link

alex6o commented Oct 16, 2013

hi! this proposed structure is exactly what iam searching for! +1 options would be more flexible and reusable ...

@ghost ghost assigned mrzmyr Oct 16, 2013
@thelarz
Copy link

thelarz commented Oct 17, 2013

I made this change locally, works great for my purposes. But if you release a version with this feature, I'll update to that release.

@rendro
Copy link
Owner

rendro commented Oct 17, 2013

@thelarz the community and the repository would benefit by you opening a pull request with your changes

@thelarz
Copy link

thelarz commented Oct 18, 2013

I'd be glad to. Check my work, I'm no JS guru.

@rendro
Copy link
Owner

rendro commented Oct 18, 2013

Can you please open a pull request or tell me where to find your code. Never mind, no one needs to be a guru to make a meaningful contribution ;)

@mrzmyr
Copy link
Collaborator Author

mrzmyr commented Oct 18, 2013

added to development branch: #51 and will be released in 2.1.0

@mrzmyr mrzmyr closed this as completed Oct 18, 2013
@thelarz
Copy link

thelarz commented Oct 18, 2013

Sorry, out of pocket today but I'm anxious to get this going. I had to
clone the repo and copy my changes in, figure out grunt, etc. Was working
on a bug I created that is causing the interior value to not display.

Sent from my iPhone

On Oct 18, 2013, at 8:41 AM, Robert Fleischmann notifications@github.com
wrote:

Can you please open a pull request or tell me where to find your code.
Never mind, no one needs to be a guru to make a meaningful contribution ;)


Reply to this email directly or view it on
GitHubhttps://github.com//issues/47#issuecomment-26596162
.

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

4 participants