This repository was archived by the owner on Aug 30, 2021. It is now read-only.
Description Hi, I've already done this in a project based on mean 0.4.0 so I guess I can make a PR if you want. Let me explain:
config/assets/default.js
views: ['modules/*/client/**/*client.view.html']
config/config.js
var initGlobalConfigFiles = function(config, assets) {
...
config.files.client.html = getGlobbedPaths(assets.client.views, 'public/');
config/lib/express.js
module.exports.initLocalVariables = function (app) {
...
app.locals.htmlFiles = config.files.client.html;
modules/core/server/controllers/core.server.controller.js
exports.renderIndex = function(req, res) {
res.locals.htmlFiles = []
res.app.locals.htmlFiles.forEach(function (html) {
var splitted = html.split('/')
var name = splitted[splitted.length-1].split('.')[0]
res.locals.htmlFiles.push({
name: name,
file: fs.readFileSync(path.resolve(html), 'utf8')
})
})
res.render('modules/core/server/views/index', {
user: req.user || null
})
}
modules/core/server/views/layout.server.view.html
{% for html in htmlFiles %}
<script type="text/ng-template" id="{{html.name}}">{{html.file | safe}}</script>
{% endfor %}
then just use it like that for a view named app.client.view.html:
$stateProvider.
state('app', {
url: '/:lang',
templateUrl: 'app',
controller: 'AppController'
})
I saw a bunch of discussions about versions, PR and stuff so... tell me what you think and what to do :)
Reactions are currently unavailable