angular app plugin
-
Ok, so to reproduce the problem I prepare a basic angular page loaded as nodebb pluging. It will certainly be easiest to check what's going wrong with the 0.7.0 version.
Here the plugin.json
{
"id": "nodebb-plugin-angtest",
"name": "Test angular app within nodebb",
"description": "An angular app to test if it works with nodebb 0.7",
"library": "./library.js",
"hooks": [
{ "hook": "static:app.load", "method": "init" },
{ "hook": "filter:header.build", "method": "addNavigation" }
],
"staticDirs": {
"static": "./static"
},
"less": [
"static/style.less"
],
"scripts": [
"static/lib/angular/angular.js",
"static/lib/app.js"
],
"templates": "./templates"
}
The library.js
"use strict"; var plugin = {}; function renderCustomPage(req, res, next) { // charger la page res.render('angular-page'); } plugin.init = function(params, callback) { // ajouter les routes var app = params.router, middleware = params.middleware; app.get('/angular', middleware.buildHeader, renderCustomPage); app.get('/templates/angular.tpl', renderCustomPage); app.get('/api/angular', renderCustomPage); callback(); }; plugin.addNavigation = function(header, callback) { // ajouter le lien dans le menu de navigation principal header.navigation.push({ class: '', route: '/angular', iconClass: 'fa fa-google', title: 'angular', text: 'angular' }); callback(null, header); }; module.exports = plugin;
The app.js
'use strict'; var myApp = angular.module('myApp',[]); myApp.controller('myCtrl', ['$scope',function($scope) { $scope.firstName= "John"; $scope.lastName= "Doe"; }]);
With this basic example I have the same behaviour. When I click on the google icon in the head menu angular module and controller are not loaded. I need to refresh the page (F5) to load the angular part.
Thanks in advance for your help.
-
Sorry, I forgot to get back to this. Can you publish your
nodebb-plugin-angtest
and I'll try running it first on 0.6x and then 0.7x and see if I can isolate the problem -
hello,
here you will find the code https://github.com/ricoud/nodebb-plugin-angtest
Thanks in advance -
@psychobunny did you have time to test the plugin?
Thanks -
Ok I tried to use filter:scripts.get hook to load angularjs same thing
Then I include angularjs inside the scripts object of the js.js file find in src/meta directory, same behaviour.
Can someone help to resolve this issue as I really want to include my site as a nodebb plugin.
Thanks in advance -
Yikes. I always forget stuff I promise on community forum haha. Your best bet always is to create an issue on our github tracker.
"Angular not working with nodebb" or something. I'm sorry for the delay
-
Issues 路 NodeBB/NodeBB
Node.js based forum software built for the modern web - Issues 路 NodeBB/NodeBB
GitHub (github.com)
Don't forget to add as much information as you can