1

My organization has a site completely designed in angularJS(Not designed by me). Now I have designed a web part using SPFx which I want to add to the existing site. The web part layout is also designed in angularJS. When I add my SPFx web part to the site the angular layout is disturbed - eg. the navigation bar and the sidebar contents don't load as expected.

Do I have to follow any steps while adding spfx to the angular site? where am I going wrong?

to be specific I get the following error on the console

ReferenceError: moment is not defined

that is 1st line inside the app.controller of the mainpage layout

$scope.Date=moment(new Date()).format("DD")

Source code on inspect on chrome browser

var startSpfx = function(spfx) {
                if (typeof markPerfStage === 'function') {markPerfStage('spModuleLoaderStart');};
                var loaderStart = function() {
                    global.moduleLoaderPromise=global.spModuleLoader.start(spClientSidePageContext, handleFailure).catch(function(e) {
                        handleFailure({message: "Can\u0027t load the application on this page. Use the browser Back button to retry. If the problem persists, contact the administrator of the site and give them the information in Technical Details.", error: e});
                    });
                };
                try {
                    if (global.useSnapshot) {
                        global.useSnapshot().then(function() {
                            loaderStart();
                        }).catch(function() {
                            loaderStart();
                        });
                    } else {
                        loaderStart();
                    }
                } catch(e) {
                    handleFailure({message: "Can\u0027t load the application on this page. Use the browser Back button to retry. If the problem persists, contact the administrator of the site and give them the information in Technical Details.", error: e});
                }
            };

Thank you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.