• 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.


  • I would love to see a fix for this and maybe a barebone angular plugin to see how it all ties together? 🙂

  • Admin

    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


  • any luck? @ricoud @psychobunny


  • Same with 0.7.1
    Additional info when calling directly the page (typing the address) everything works. It seems that angular isn't loaded when calling the page through menu.


  • Same behaviour with 0.8.0 😥


  • 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 😄

  • Admin

    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

  • Admin

    https://github.com/NodeBB/NodeBB/issues

    Don't forget to add as much information as you can 🙂

Suggested Topics

  • 1
  • 13
  • 7
  • 9
  • 1
| |