Angular Dynamic Forms and JHipster - jhipster

I am working on a JHipster project (monolith, angular 4 currently) and recently have been investigating the use of dynamic forms.
I came across the following:
https://www.npmjs.com/package/angular2-json-schema-form
Should JHipster move to natively support this feature ?
Any advise on embracing dynamic forms into the current jhipster generated client side typescript code ?
I am thinking of modifying the client side model objects manually to incorporate form data that can be be used in dynamic forms.. and removing most of the HTML form code.
Thanks,
Fergal

Related

Tabulator and Polymer 3

has anyone tried using Tabulator in a Polymer 3 project?
Polymer is not supported by Tabulator but maybe someone has tried to integrate it.
Thanks
Tabulator is a vanilla JS library, as such it will work in any JavaScript Frontend Framework without issue.
The supported frameworks list on the website simply demonstrates how to set it up with those frameworks. If you follow the standard Quickstart Guide you should be up and running in no time.
With most frameworks it is simply a matter of passing a reference to the div created by the framework into the first argument of the constructor instead of the CSS selector string.
You would normally need to instantiate Tabulator after the render phase of your particular framework.
If you do get something setup then please submit some simple demo code as an issue on the Tabulator Git Repo and i can add it to the website to help others
The Framework Documentation includes several examples of setting up Tabulator in a frontend framework that should give you some pointers on how to address the issue.

Best Js framework can be used with sharepoint

I new in Sharepoint, i wanna create forms, session, CRUD operations, send messages via Skype API.
i am confused which JS framework i have to use with Sharepoint in client-side and why?
Angular JS, View JS, Knockout JS, React JS.. Or other JS framework?
SharePoint is agnostic to these frameworks. Means, it does not use any of the listed frameworks. Also it does not require you to use any of those frameworks. So you can choose whatever you know better. Or you can go without any framework at all.
I'm using right now React Js with SharePoint for more than 2 years. I didn't find any issue with it.

Prismic.io in Angular 2

I'm trying to find a way to import the Prismic.io javascript kit in my Angular 2 project.
Is there a way to do so ? I tried to understand their Angular2-starter but it's not documented to do it on an existing project.
I want to know if there is a way to import node modules directly into Angular2 ?
Thanks in advance !
You need to be more specific, what does it mean import modules directly into angular 2?
First, to have common ground about modules:
Modules are a core feature of javascript, either natively in ES6 or using bundlers (e.g WebPack, SystemJS, etc...)
Importing a modules is not related to Angular 2
As for Angular 2, if by using directly you mean being able to inject service via the dependency injection then this is just a configuration operation done in angular.
In the case of an external, 3rd party, NON Angular library you might want to wrap it with an angular service which is then injected.
The starter project you linked to does so, it defined a prismic-service class that wrap the original prismic library so you only work against the wrapper class.
You can extend this class to support more features as you go.
Some notes on extending 3rd part libraries in angular 2 vs angular 1:
AngularJS (1) developers approach 3rd party libraries with caution. Since AngularJS has an internal change detection mechanism that Angular has to manage, execute and control. Any 3rd party library that modifies data that directly or indirectly effects the UI must also trigger the internal change detection in angular.
In Angular2 change detection is triggered by generic async operations such as events, user interactions, etc... Angular does not manage it directly, it is triggered automatically as if it was magic. This is possible due to the help of Zones which is both a concept and a library. Angular implements NgZone.
Basically it means that you can use prismic directly or as a wrapped angular service, it doesn't matter, it will just work.
I guess that most of your questions will focus on integration, which is how to take the data from the API and make a UI out of it.
The prismic Development kit provides a REST API for retrieving metadata about UI elements and data that they contain.
The client (in a SPA, like angular 2) needs to display actual UI components from the metadata.
In other words you need to build Angular 2 components that correspond to the components in prismic.
A common JavaScript library that builds a UI from prismic REST API data will not work here. It will generate HTML code that is not part of the angular application and does no participate in change detection, lifecycle hooks and routing.
All components in angular must be compiled first, at the bootstrap or at build if offline compiler is used.
The minimal approach is to get the HTML markup from the server and inject it into an angular component acting as a wrapper. This allows control over the lifecycle of a page and used for routing, page transition animation etc...
The starter project provides such a wrapper called DocumentPage. The DocumentPage has logic to download it's content (via route parameters) from prismic and display it as raw HTML. See here
The html markup retrieved from prismic is NOT bindable and you can't apply change detection and expressions in it. If you split it into chunks you can apply some angular magic in between.
So, it's quite simple actually, the starter project is a simple wrapper around the prismic framework in both API and UI. Angular has a small part in the application as it acts as a simple wrapper/container. The actual content is driven by prismic. I don't see benefits using angular with such approach, it doesn't do any harm but it's not really an angular app.
A proper angular2 prismic app would be built upon pure metadata representation of components which are implemented in angular as angular components. It is quite an advanced app that requires dynamic component creation as well as advanced routing implementation with lazy loading (to introduce new components on the fly).

Recommended approach for admin site and front end using MEAN stack?

I want to build a website using the MEAN stack and my database schema will be defined using Mongoose. This website will have an admin site, in which I will have all the CRUD operations for the data displayed by the frontend website. As the object model will be the same, if I'm using Java or C# I would compile this classes in a Jar or Dll and use it in my frontend site, along with the DB definitions and repositories (say hibernate)
What will be a recommended approach for reuse this object model in this MEAN scenario? Is it common to have another "folder" in my express setup? What if I want to run the admin site on another port?
I see you have no response yet, one example; Here is a nice scaffold that im working with which uses also JS, not C or Java and is a fairly good example of what your looking for i think. This will help you expedite, expand and go in which direction you want from there, by being a very adjustable MEAN stack scaffold using MOngoose, having CRUD examples, and even Bootstrap Jade SASS front end to help facilitate if you want to use it.
You would separate out your admin site as one of the MVC sections, and so forth, just like you would on any other MVC site pretty much, you can just follow the code standards in the documentation there.

What is the kohana framework used for?

I´m learning kohana for the first time and need to know some basic facts about the mcv principle.
Up until now i´ve only used Javascript frameworks (ext, openlayers etc) which are referenced in the headers of html pages. The classes are then extracted and used in applications. I can have as many separate applications referencing one Ext.js framework installation as I like.
Kohana,as an mvc framework, is obviously different, but which purpose does it fullfill? Is it used to create web applications inside the Kohana installation ie. one web application...or is it used to create an endless number of applications? As far as I can see, one downloads the kohana framework, and adapts/extends the framework to make an application..e.g. a web cms. Am I on the right lines?
cheers,
Rob
The Kohana framework is typically used to build a web application. You would normally use one Kohana install and work with that to make a web application.
You could if you wanted, install Kohana centrally in somewhere like /usr/share/Kohana
Then you would move the application folder out and set the update the paths in index.php to the right places (there is a system path, module path and application path).
MVC allows is a design pattern for separation of business logic (model), controller (uses the model to get data and pass it to the view) and the view normally is what is outputted to the browser (HTML). You can read more here
http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller
Yes, typically each web application has its own copy of a library. So, one copy of Kohana is extended to one web app.
MVC is a pattern that is common in web frameworks. It leads to better code reuse and lose coupling among different parts of the app.

Resources