The problem here seems to be that Clojurescript doesn't know anything
about the dependencies of your application. Try adding a :require
statement.

On Sun, Apr 6, 2014 at 6:42 PM, Ivan Schuetz <[email protected]> wrote:
> I have a cljs file that depends on another. But the compiled script is 
> inserting the scripts in the wrong order. So when this code tries to access 
> some functionality which was initialized in the second file, it throws an 
> error.
>
> How is the ordering determined? Is there any way to change this?
>
> These are my scripts. It's an AngularJS application.
>
> app.cljs - here I declare AngularJS module, which I'll retrieve in the 
> other.cljs:
>
> (ns myapp.mainscript
>   (:require [jayq.core :as jq])
>   (:use [jayq.core :only [$]]
>         [clojure.string :only [blank?]])
>   )
>
> (let [app (-> js/angular
>            (.module "myproj" ["myproj.controllers"]))])
>
>
> other.cljs:
>
> (ns myapp.other
>   (:require [jayq.core :as jq])
>   (:use [jayq.core :only [$]]
>         [clojure.string :only [blank?]])
>   )
>
>
> (def app (-> js/angular (.module "myproj")))
>
> (println app)
>
>
> This is generated JS - the first script is in the last line app_6414 = ...
>
> myapp.add_product_controller.app = angular.module("myproj");
> cljs.core.println.call(null, myapp.add_product_controller.app);
> myapp.mainscript = {};
> var app__6414 = angular.module("myproj", 
> cljs.core.PersistentVector.fromArray(["myproj.controllers"], !0));
>
>
> For I moment I thought the ordering could be related to my use of variables 
> "app", but these should be independent of each other.
>
> What's the problem here? how can I fix this?
>
> --
> Note that posts from new members are moderated - please be patient with your 
> first post.
> ---
> You received this message because you are subscribed to the Google Groups 
> "ClojureScript" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/clojurescript.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to