Tuesday, September 23, 2014

In ExpressJS it Appears that Order Matters

In my expressjs app if I have code in this order everything is good:
app.use(express.static(path.join(__dirname, 'public')));

// uncomment after placing your favicon in /public
app.use(session({ secret: 'secret',  cookie: { httpOnly: false },
    saveUninitialized: true,
    resave: true} ));
However if I move the 'use session' to before the 'use static' then the app waits 2 minutes before serving JavaScript files, not all JavaScript files and not the same files each time, just random JavaScript files

Monday, September 22, 2014

AngularJS ui-router and ngTemplate

Using ui-router with templates in an AngularJS application. If I do this then the ng-view does not work unless either the ng-view is in top level HTML (or at least that's how it appears), or I call app.run and inject $state. So, I have something like
<div ng-app="app">
    <div>
        <div data-ng-include="'/app/layout/shell.html'"></div>
    </div>
</div>
and then in shell.html
    
<section id="content" class="main">
        <div ui-view></div>
</section>
This doesn't work unless I call
app.run($scope){}
However this:
<div ng-app="app">
    <div>
       <div ui-view></div>
    </div>
</div>
does.