How is the SharePoint FX's integration with Angular? I know it has good support for React, but want to know the pros and cons of SharePoint Framework with Angular 6+
Lets update some of the files for Angular to work with SharePoint Framework.
package.json
"#angular/common": "^6.0.3",
"#angular/compiler": "^6.0.3",
"#angular/core": "^6.0.3",
"#angular/elements": "^6.0.3",
"#angular/platform-browser": "^6.0.3",
"#angular/platform-browser-dynamic": "^6.0.3",
"#webcomponents/custom-elements": "^1.1.1",
"core-js": "^2.5.7",
"rxjs": "^6.2.0",
"zone.js": "^0.8.26"
tsconfig.json
This is the TypeScript configuration file for the IDE. Open tsconfig.json file, add below line under "compilerOptions".
"emitDecoratorMetadata": true,
gulpfile.js
This file defines all the tasks for the project like compiling TypeScript files to JavaScript, bundle and minify JS/CSS files etc. We need to modify the build process. Open "gulpfile.js" file and add below code just above the "build.initialize" line.
const webpack = require('webpack');
const path = require('path');
build.configureWebpack.mergeConfig({
additionalConfiguration: (generatedConfiguration) => {
generatedConfiguration.plugins.push(new webpack.ContextReplacementPlugin(/\#angular(\\|\/)core(\\|\/)fesm5/, path.join(__dirname, './client')));
return generatedConfiguration;
}
});
Here are two solution with source code about use Angular 6 in SharePoint framework for your reference.
Angular Demo Webpart
Angular Elements in SharePoint Framework
Related
I have created a web part using SPFx React. Below is my package
"#material-ui/core": "^4.12.4",
"#material-ui/icons": "^4.11.3",
"#microsoft/sp-core-library": "1.14.0",
"#microsoft/sp-lodash-subset": "1.14.0",
"#microsoft/sp-office-ui-fabric-core": "1.14.0",
"#microsoft/sp-property-pane": "1.14.0",
"#microsoft/sp-webpart-base": "1.14.0",
"#mui/x-data-grid": "^4.0.2",
"#pnp/sp": "^2.11.0",
"office-ui-fabric-react": "7.174.1",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-router-dom": "^5.3.0",
"typescript": "^2.9.1"
This web part is working correctly under the local workbench https://contoso.sharepoint.com/sites/contoso/_layouts/15/workbench.aspx
When I generate a package of that app and add that to the SharePoint page (https://contoso.sharepoint.com/sites/contoso/SitePages/contoso.aspx). It Freezes the Browser and returns the below errors.
not enough memory to open this page
Something went wrong while displaying the webpage
Can anyone help me with the same?
So I have simple express app. When it run locally, I can see js, css files got gzip compressed but when I deploy to cloud foundry, those files not compressed. The files size still the same.
Anyone know the reason, how to fix it or solutions for this issue ?
const express = require('express');
const compression = require('compression');
const app = express();
app.use(compression());
app.use(express.static('./public'));
Package.json
{
"name": "conversation-simple",
"description": "A simple Node.js based web app which shows how to use the Conversation API to recognize user intents.",
"version": "0.1.1",
"main": "server.js",
"scripts": {
"start": "node server.js"
},
"dependencies": {
"#google/chatbase": "^1.1.2",
"body-parser": "^1.18.2",
"botbuilder": "^3.15.0",
"cloudant": "^1.10.0-NOTICE",
"compression": "^1.7.3",
"cors": "^2.8.4",
"dotenv": "^2.0.0",
"express": "^4.16.1",
"gulp-rename": "^1.4.0",
"moment": "^2.22.2",
"nano": "^6.4.4",
"request": "^2.87.0",
"slick-carousel": "^1.8.1",
"underscore": "^1.9.0",
"universal-analytics": "^0.4.16",
"watson-developer-cloud": "^3.5.3",
"xml-js": "^1.6.3"
},
"engines": {
"node": "8.15.x"
}
}
Update:
Look like there is location problem. When it's deployed to Sydney, the compression doesn't work but Dallas is ok. IBM support have confirmed the issue in my ticket and currently investigate.
I have the same issue, I feel like I've tried absolutely everything so far:
Static Gzipping (serving .gz files)
Brotli (no dice)
Dynamic compression (like you)
Redirect to static .gz files
It works locally as it should but once deployed - farting noise nothing.
I have a feeling it happens in the proxy and needs to be enabled somewhere, where is not documented though
Commenting here to follow this, also I've contacted their support, if I get any answers I will put them here :)
This issue was fixed by IBM.
"After investigation, we found an issue that strips the header and decompresses the response in the Cloud Foundry Platform AU-SYD region."
I'm encountering error messages in the console when serving angular app in production.
I never got those errors before and besides playing around with the web.config to change the rewrite URLs, nothing has changed.
After building the app locally and serving it via my local IIS, the app loads and runs.
But when I try to reach it in production, I get:
Uncaught SyntaxError: Unexpected token < (index):1
and also
Uncaught Error: In this configuration, Angular requires Zone.js
The app DOES RUN in production when I try to run it in incognito.
I'm using
"#angular/cli": "1.6.0-rc.1",
"zone.js": "^0.8.14"
"#angular/animations": "^5.0.0",
"#angular/common": "^5.0.0",
"#angular/compiler": "^5.0.0",
"#angular/core": "^5.0.0",
"#angular/forms": "^5.0.0",
"#angular/http": "^5.0.0",
"#angular/platform-browser": "^5.0.0",
"#angular/platform-browser-dynamic": "^5.0.0",
"#angular/router": "^5.0.0",
"#angular/service-worker": "^5.0.0",
Ok, I can't explain why incognito works or why all of the sudden I got this error but upgrading to the latest cli 1.6.8 solved it
While AOT compiling the project with Kendo Angular2 NumericTextBox and MaskedTextBox, following error occurs:
maskedtextbox.component.ngfactory.ts:275:35: Supplied parameters do not match any signature of call target.
maskedtextbox.component.ngfactory.ts:279:35: Supplied parameters do not match any signature of call target.
maskedtextbox.component.ngfactory.ts:283:35: Supplied parameters do not match any signature of call target.
numerictextbox.component.ngfactory.ts:203:41: Property 'widgetClass' is private and only accessible within class 'NumericTextBoxComponent'
numerictextbox.component.ngfactory.ts:208:41: Property 'numericClass' is private and only accessible within class 'NumericTextBoxComponent'
6.numerictextbox.component.ngfactory.ts:242:48: Property 'hostBlur' is protected and only accessible within class 'NumericTextBoxComponent' and its subclasses.
Here is my package.json entries:
"#angular/common": "2.4.0",
"#angular/compiler": "2.4.0",
"#angular/compiler-cli": "2.4.0",
"#angular/core": "2.4.0",
"#angular/forms": "2.4.0",
"#angular/http": "2.4.0",
"#angular/platform-browser": "2.4.0",
"#angular/platform-browser-dynamic": "2.4.0",
"#angular/platform-server": "2.4.0",
"#angular/router": "3.4.0",
"#progress/kendo-angular-buttons": "0.14.0",
"#progress/kendo-angular-dialog": "0.14.1",
"#progress/kendo-angular-dropdowns": "0.24.4",
"#progress/kendo-angular-intl": "0.9.0",
"#progress/kendo-angular-grid": "0.7.0",
"#progress/kendo-angular-popup": "0.15.0",
"#progress/kendo-angular-upload": "0.12.0",
"#progress/kendo-data-query": "0.2.0",
"#progress/kendo-popup-common": "0.3.0",
"#progress/kendo-angular-inputs": "0.18.2",
"#progress/kendo-theme-default": "2.11.4",
"#telerik/kendo-dropdowns-common": "0.2.0",
"#telerik/kendo-intl": "0.12.0",
"#telerik/kendo-theme-default": "1.32.0",
"#telerik/kendo-draggable": "1.5.1",
"#telerik/kendo-inputs-common": "2.1.0",
AppModule imports
import { DialogModule } from '#progress/kendo-angular-dialog';
import { DropDownsModule } from '#progress/kendo-angular-dropdowns';
import { PopupModule } from '#progress/kendo-angular-popup';
import { IntlService } from '#progress/kendo-angular-intl';
Another Module imports
import { GridModule } from '#progress/kendo-angular-grid';
import { UploadModule } from '#progress/kendo-angular-upload';
import { InputsModule } from '#progress/kendo-angular-inputs';
Why all the telerik packages? You probably don't need those. Could you also share your app.module.ts file?
You should use only the #progress package and declare this in your app.module.ts :
import { InputsModule } from '#progress/kendo-angular-inputs';
edit: Answered too fast, they are dependancies for the progress packages. You shouldn't put them in your packages.json, though, as they will be installed automatically by npm as dependancies.
I am having this problem as well (or something very similar). I can not run the JIT version of my application (using "npm start" with the lite server) or build the application into an AOT version. I'm not even using the masked textbox anywhere in my application. The only reason I have inputs installed at all is for the slider.
Anyhow, I can understand the build causing errors if something is wrong in the factory component but I do not understand why running the JIT version would be an issue. Maybe since the AOT folder resides within my root npm installed application folder everything gets JIT compiled on npm start?
I was able to get the JIT version running by deleting the following files:
AOT\app
AOT\#progres
AOT\#telerik
I cannot however build the application. When I attempt, I get the following:
Error at
C:/Dashboard/aot/node_modules/#progress/kendo-angular-inputs/dist/es/slider/slider-ticks.component.ngfactory.ts:87:7:
Supplied parameters do not match any signature of call target.
Error at
C:/0/Health/Dashboard-lite/aot/node_modules/#progress/kendo-angular-inputs/dist/es/slider/slider.component.ngfactory.ts:207:7:
Supplied parameters do not match any signature of call target.
Examining the slider-ticks.component.ngfactory, the error looks like this:
Hopefully this helps to eventually solve the problem...
getting the same error. i modified the file numerictextbox.component.d.ts to remove private/protected from the 3 declaration. and made type of widgetClass and numericClass to any to make aot build work
can these be ignored?
Error at
App/aot/node_modules/#progress/kendo-angular-inputs/dist/es/numerictextbox/numerictextbox.component.ngfactory.ts:195:41: Property 'widgetClass' is private and only accessible within class 'NumericTextBoxComponent'.
Error at
App/aot/node_modules/#progress/kendo-angular-inputs/dist/es/numerictextbox/numerictextbox.component.ngfactory.ts:200:41: Property 'numericClass' is private and only accessible within class 'NumericTextBoxComponent'.
Error at
App/aot/node_modules/#progress/kendo-angular-inputs/dist/es/numerictextbox/numerictextbox.component.ngfactory.ts:214:48: Property 'hostBlur' is protected and only accessible within class 'NumericTextBoxComponent' and its subclasses.
OK, I'm fairly new to all this front end programming and I hope my question is not silly.
I have an existing app made with an express.js framework with a custom gulp config and ejs. Now, I want to integrate the all new shiny Foundation for Apps into it.
On the Zurb website, the manual install is only a one-liner through bower or npm (http://foundation.zurb.com/apps/docs/index.html#!/installation)
bower install foundation-apps --save
npm install foundation-apps --save
So that's what I did, but the Foundation formatting is not happening at all.
I tried to include the CDN reference lines (css and js) too, but the same is happening.
When I proceed to create an app with the "normal" installation, everything is working great. But I want to use the Express framework and this is not the case here!
I am missing something but I don't see what.
package.json
{
"name": "2004app",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
},
"dependencies": {
"apache-server-configs": "^2.7.1",
"body-parser": "~1.12.0",
"browser-sync": "^1.3.0",
"cookie-parser": "~1.3.4",
"debug": "~2.1.1",
"del": "^1.1.0",
"ejs": "~2.3.1",
"express": "~4.12.2",
"foundation-apps": "^1.1.0",
"gulp": "^3.8.11",
"gulp-autoprefixer": "^2.0.0",
"gulp-cache": "0.2.2",
"gulp-changed": "^1.0.0",
"gulp-concat": "2.5.2",
"gulp-csso": "^1.0.0",
"gulp-flatten": "0.0.4",
"gulp-if": "^1.2.1",
"gulp-imagemin": "^2.0.0",
"gulp-jshint": "^1.6.3",
"gulp-load-plugins": "^0.8.0",
"gulp-minify-html": "0.1.5",
"gulp-nodemon": "^2.0.2",
"gulp-rename": "1.2.2",
"gulp-replace": "^0.5.0",
"gulp-sass": "^1.2.0",
"gulp-size": "^1.0.0",
"gulp-sourcemaps": "^1.3.0",
"gulp-uglify": "^1.0.1",
"gulp-uncss": "^1.0.0",
"gulp-useref": "^1.0.1",
"jshint-stylish": "^1.0.0",
"morgan": "~1.5.1",
"opn": "^1.0.0",
"psi": "^1.0.4",
"require-dir": "^0.1.0",
"run-sequence": "^1.0.1",
"serve-favicon": "~2.2.0"
}
}
For example, the following code is not rendering like it should. It only shows a line with 3 times "Content goes here", instead of this : http://foundation.zurb.com/apps/docs/#!/accordion
<zf-accordion>
<zf-accordion-item title="Input your title here">
Content goes here
</zf-accordion-item>
<zf-accordion-item title="Input your title here">
Content goes here
</zf-accordion-item>
<zf-accordion-item title="Input your title here">
Content goes here
</zf-accordion-item>
</zf-accordion>
Is what I am trying to do possible ?
How can I use the CDN references ? (I successfully put CDN references for bootstrap in another app)
Thanks!
It is possible!
Though it has quite a few moving pieces that you should understand.
I recently did the same thing, but depending on the size of your app's frontend it may take some time to understand everything that is going on. It's not as simple as just including a library.
You mention express app, is it an Angular app? First thing if your not familiar with Angular I would read about it and specifically 'Modules' as in the end that is all Foundation Apps is.
https://docs.angularjs.org/guide/module
You will need to create your angular module and have Foundation as dependency.
Also it is good to realize that the way that foundation for apps is packaged its meant to be compiled in its own weird sort of way. So basically whenever you make changes your re-compiling your front end html/logic/css.
Make sure your express app is serving up the Single Page Application which is Foundation Apps. Be sure to watch your web development console to see if your getting any strange Angular errors. If you are you can typically click on them and get help from the angular site.
Also the Foundation Apps gulp task is unique in it has its own little plugin to create the routing based off the templates. See the following link:
http://foundation.zurb.com/apps/docs/#!/angular
If your just getting into Front End Frameworks I would suggest going through a few basic Angular tutorials before tackling a angular app such as Foundation Apps.
Once familiar with Angular look at exactly what the Gulp build is doing (gulpfile.js). It takes care of the following:
Copies static resources
Its running SASS and compiling styling
Copies Foundation for Apps Javascript
Copies the templates and builds the routes (the route building is a little hidden
Once you understand what the Gulpfile.js is doing you should start to piece together how the front end is built.
I reworked it using Grunt, but ended up switching back to gulp because of their template job (ngHtml2js)
Don't giveup, be persistent and it will slowly make sense!
I'm working on the same task you mentioned up there, an existing MEAN application, that I developed with ejs front end template, and a front-end that I developed with the foundation-apps tools, the front-end has everything I need for my MEAN back-end, now for merging all of this together into a single node app.
UI is developed independently using foundation for app build tools such as gulp, considering my UI is developed with all the zurb foundation html parts are included to represent all the required functions served by my MEAN app. So after the build with foundation-apps the resulting build folder contains basic assets without any SASS or the need for foundation-apps to be in the package.json dependencies, since the foundation.js file is in the assets folder for the front-end, and sass is already built into app.css
I dont see how it's possible to have two single page web apps running on the same node server, in case I try separating the two different app configurations, angular dependency injection, routes, index files separated etc..
The challenge is wrapping up a single page web app with all dependencies, while maintaining how the foundation UI manages it's routing, as it is quite different from how express manages routing, it happens using different libraries.