Skip to content

Instantly share code, notes, and snippets.

@p14n
Created August 14, 2013 09:27
Show Gist options
  • Save p14n/6229362 to your computer and use it in GitHub Desktop.
Save p14n/6229362 to your computer and use it in GitHub Desktop.
(ns gameapp)
(def gamemod
"Create a gameapp module within Angular.js"
(.module js/angular "gameapp" (array)))
(.directive gamemod "gameslist"
(fn []
(js-obj
"restrict" "E"
"scope" (js-obj "games" "=")
"template" "<div ng-repeat='game in games'>Game {{game.name}}</div>"
)))
(defn ^:export GameCtrl [$scope]
(aset $scope "mygames" (array
(js-obj "name" "a")
(js-obj "name" "b")
(js-obj "name" "c"))))
(aset GameCtrl "$inject" (array "$scope"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment