Permalink
Browse files

refactor, fix GhVisualization to ghVisualization

  • Loading branch information...
1 parent 808e5ec commit 3969dd30db764a22d4d4eb72b06fc487ad6fa28c @btford committed Aug 1, 2012
Showing with 13 additions and 8 deletions.
  1. +4 −3 app.js
  2. +9 −5 index.html
View
7 app.js
@@ -103,7 +103,7 @@ d3DemoApp.controller('AppCtrl', function AppCtrl ($scope, $http) {
});
-d3DemoApp.directive('GhVisualization', function () {
+d3DemoApp.directive('ghVisualization', function () {
// constants
var margin = 20,
@@ -115,8 +115,8 @@ d3DemoApp.directive('GhVisualization', function () {
restrict: 'E',
terminal: true,
scope: {
- val: '=val',
- grouped: '=grouped'
+ val: '=',
+ grouped: '='
},
link: function (scope, element, attrs) {
@@ -290,6 +290,7 @@ d3DemoApp.directive('GhVisualization', function () {
// setup a watch on 'grouped' to switch between views
scope.$watch('grouped', function (newVal, oldVal) {
+ // ignore first call which happens before we even have data from the Github API
if (newVal === oldVal) {
return;
}
View
@@ -25,18 +25,22 @@
font-weight: 300;
margin-bottom: .3em;
}
+ .error {
+ color: red;
+ }
</style>
</head>
<body ng-controller="AppCtrl">
<h1>Github Commit Graph</h1>
- <div>
- User: <input ng-change="getCommitData()" ng-model="user"></input>
- Repo: <input ng-change="getCommitData()" ng-model="repo"></input>
+ <form ng-submit="getCommitData()">
+ User: <input ng-model="user"></input>
+ Repo: <input ng-model="repo"></input>
+ <input type="submit" value="Get Data">
Grouped <input type="checkbox" ng-model="grouped">
- </div>
+ </form>
- <p>{{error}}</p>
+ <p class="error">{{error}}</p>
<gh-visualization val="data" grouped="grouped"></gh-visualization>
</body>
</html>

0 comments on commit 3969dd3

Please sign in to comment.