Basically, my problem is that "I am {{ 10 + 13 }}" is what is being rendered for a second/half a second, before the "store" module is being created in main.js.
<!DOCTYPE html>
<html lang="en" ng-app="store">
<head>
<title>...</title>
<script data-main="main.js" src="../bower_components/requirejs/require.js"></script>
<link href="../bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
I am {{ 10 + 13 }}
</body>
main.js sets the requirejs configs, requires the angular library and sets the "store" module:
require.config({
paths: {angular: '../bower_components/angular/angular.min'},
shim: {angular: {exports: 'angular'}}
});
require(['angular'], function(angular) {
var app = angular.module('store', []);
});
I think the reason this occurs, is because main.js and the angular library are being loaded asynchronously by requirejs (with an "async" attribute on the script tag), so the DOM gets rendered before the store module has been created, thus creating a delay.
What would I have to do to avoid this gap that occurs between rendering "I am {{ 10 + 13 }}" and "I am 13"? I could load both main.js and the angular js synchronous/without requirejs, but that does not seem like a best practice.