Skip to content

Creating Angular Controller from Fay Module: API brainstorm #3

Description

@chreekat

Here's what I'm using to generically build a controller out of a Fay module.

# CoffeeScript

angModule = angular.module("angModule", [])

angModule.controller("FooCtl", ($scope) ->
        $scope[k] = v for own k, v of Strict.HaskModule
)

Assuming this is even a good starting point, is there a way to package up that code into Fay action? Say, for instance,

angularModule :: Text -- ^ module's name
              -> [AngularModule] -- ^ module deps
              -> Fay AngularModule

addController :: Text -- ^ controller name
              -> Text -- ^ Haskell module to use (FIXME, obviously(?))
              -> AngularModule -- ^ Angular module to attach the controller to
              -> Fay ()

and then:

main = do
    angMod <- angularModule "angModule"
    addController "FooCtl" "HaskModule" angMod

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions