{"action":"created","issue":{"url":"https://api.github.com/repos/rzajac/angularjs-slider/issues/158","labels_url":"https://api.github.com/repos/rzajac/angularjs-slider/issues/158/labels{/name}","comments_url":"https://api.github.com/repos/rzajac/angularjs-slider/issues/158/comments","events_url":"https://api.github.com/repos/rzajac/angularjs-slider/issues/158/events","html_url":"https://github.com/rzajac/angularjs-slider/pull/158","id":113044468,"number":158,"title":"Refactor to add an rzSliderOptions attribute","user":{"login":"ValentinH","id":2678610,"avatar_url":"https://avatars.githubusercontent.com/u/2678610?v=3","gravatar_id":"","url":"https://api.github.com/users/ValentinH","html_url":"https://github.com/ValentinH","followers_url":"https://api.github.com/users/ValentinH/followers","following_url":"https://api.github.com/users/ValentinH/following{/other_user}","gists_url":"https://api.github.com/users/ValentinH/gists{/gist_id}","starred_url":"https://api.github.com/users/ValentinH/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ValentinH/subscriptions","organizations_url":"https://api.github.com/users/ValentinH/orgs","repos_url":"https://api.github.com/users/ValentinH/repos","events_url":"https://api.github.com/users/ValentinH/events{/privacy}","received_events_url":"https://api.github.com/users/ValentinH/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rzajac/angularjs-slider/labels/waiting-for-votes","name":"waiting-for-votes","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-23T15:37:01Z","updated_at":"2015-10-25T06:31:50Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rzajac/angularjs-slider/pulls/158","html_url":"https://github.com/rzajac/angularjs-slider/pull/158","diff_url":"https://github.com/rzajac/angularjs-slider/pull/158.diff","patch_url":"https://github.com/rzajac/angularjs-slider/pull/158.patch"},"body":"# Waiting for feedback / votes / remarks / advices!\r\n\r\nThe goal is to reduce the number of options we need to set on the DOM element  and to enable each options to be changed at runtime (step for instance #103). \r\n\r\nBefore, we had to add one watch for each property that needed to be update-able at runtime, now there is only one watch on the rzSliderOptions object.\r\nThe only remaining attributes are `rzSliderModel` and `rzSliderHigh`; all other attributes are moved to `rzSliderOptions`.\r\n\r\nrzSliderOptions accepts an object that can contains these properties:\r\n```js\r\n{\r\n    floor: 0,\r\n    ceil: null, //defaults to rz-slider-model\r\n    step: 1,\r\n    precision: 0,\r\n    translate: null,\r\n    draggableRange: false,\r\n    showSelectionBar: false,\r\n    hideLimitLabels: false,\r\n    readOnly: false,\r\n    disabled: false,\r\n    interval: 350,\r\n    showTicks: false,\r\n    showTicksValues: false,\r\n    scale: 1,\r\n    onStart: null,\r\n    onChange: null,\r\n    onEnd: null\r\n}\r\n```\r\n\r\nMoreover, now, you can set a bunch of custom global options applied to all sliders using the  `RzSliderOptions.options()` method:\r\n```js\r\nangular.module('App', ['rzModule'])\r\n\t.run(function( RzSliderOptions ) {\r\n\t\t// show ticks for all sliders\r\n\t\tRzSliderOptions.options( { showTicks: true } );\r\n\t});\r\n```\r\n\r\n## Example\r\n\r\n### Before\r\n```html\r\n<rzslider\r\n    rz-slider-floor=\"0.5\"\r\n    rz-slider-ceil=\"10.5\"\r\n    rz-slider-step=\"0.3\"\r\n    rz-slider-precision=\"1\"\r\n    rz-slider-model=\"slider_data.value\"\r\n    rz-slider-on-start=\"onStart()\"\r\n    rz-slider-on-change=\"onChange()\"\r\n    rz-slider-on-end=\"onEnd()\"></rzslider>\r\n```\r\n```js\r\n  $scope.slider_data = {\r\n    value: 10\r\n  };\r\n```\r\n\r\n### Now\r\n```html\r\n  <rzslider\r\n\t  rz-slider-model=\"slider_data.value\"\r\n\t  rz-slider-options=\"slider_data.options\"\r\n\t  ></rzslider>\r\n```\r\n\r\n```js\r\n  $scope.slider_data = {\r\n    value: 10,\r\n    options: {\r\n    \tfloor: 0.5,\r\n    \tceil: 10.5,\r\n    \tstep: 0.3,\r\n    \tprecision: 1,\r\n    \tonStart: function() {},\r\n    \tonChange: function() {},\r\n    \tonEnd: function() {}\r\n    }\r\n  };\r\n```\r\n\r\nI'm aware that this will break current implementation (that's why it will be 2.0.0 based on semantic-version) but the goal is to reduce the DOM size, share configs among sliders and reduce the number of watchers."},"comment":{"url":"https://api.github.com/repos/rzajac/angularjs-slider/issues/comments/150896530","html_url":"https://github.com/rzajac/angularjs-slider/pull/158#issuecomment-150896530","issue_url":"https://api.github.com/repos/rzajac/angularjs-slider/issues/158","id":150896530,"user":{"login":"vitamink","id":715109,"avatar_url":"https://avatars.githubusercontent.com/u/715109?v=3","gravatar_id":"","url":"https://api.github.com/users/vitamink","html_url":"https://github.com/vitamink","followers_url":"https://api.github.com/users/vitamink/followers","following_url":"https://api.github.com/users/vitamink/following{/other_user}","gists_url":"https://api.github.com/users/vitamink/gists{/gist_id}","starred_url":"https://api.github.com/users/vitamink/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vitamink/subscriptions","organizations_url":"https://api.github.com/users/vitamink/orgs","repos_url":"https://api.github.com/users/vitamink/repos","events_url":"https://api.github.com/users/vitamink/events{/privacy}","received_events_url":"https://api.github.com/users/vitamink/received_events","type":"User","site_admin":false},"created_at":"2015-10-25T06:31:50Z","updated_at":"2015-10-25T06:31:50Z","body":"This approach looks a lot cleaner... I like it :-)"}}