没有npm,可以使用JSF中嵌入的Primeng,Angular2吗? [英] Is possible to use Primeng, Angular2 embedded in JSF without npm?

查看:58
本文介绍了没有npm,可以使用JSF中嵌入的Primeng,Angular2吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将angular2框架用于前端,因此对于UI部分,我想使用primeng,但我不知道npm的工作原理.

I want to use angular2 framework for frontend, so for UI part I want to use primeng but I don't know how npm works.

技术信息:

  1. 我的IDE是eclipse/netbeans
  2. 项目将部署在Wildfly8.0上

我可以将JSF组件与primeng混合吗?

Can I mix JSF components with primeng?

推荐答案

TL; DR:是可以的,但是还有更好的选择

重要概念:

  • AngularJS是角度版本1的同义词
  • Angular2是角度版本2的同义词(与v1不向下兼容)
  • primeng是一个依赖于angular2
  • 的组件库
  • primefaces是一个依赖于JSF
  • 的组件库
  • JSFangular2是MVC框架,尽管术语相似,但每个框架都有基于注解(@annotation)的注入机制.
  • angular2 + primeng用于typescript(推荐)或javascript,另一方面,JSF + primefaces用于java
  • primeng是客户端,primefaces是服务器端
  • 开发primeng的公司与开发primefaces的公司相同,最近,作为用户,我们看到了很好的协同作用,如果其中一个组件有所改进,则可以移植到另一个库中.
  • 目前(2016年)primefaces的组件比primeng更多,并且感觉更优美
  • AngularJS is a synonym for angular version 1
  • Angular2 is synonym for angular version 2 (not backwards compatible with v1)
  • primeng is a components library that depends on angular2
  • primefaces is a components library that depends on JSF
  • JSF and angular2 are MVC frameworks, where each one has injection mechanisms based on annotations (@annotation) although the terminology is similar the underneath of both mechanisms is very different
  • angular2 + primeng is used with typescript (recommended) or javascript, on the other hand, JSF + primefaces is used with java
  • primeng is client-side, primefaces is server-side
  • the company developing primeng is the same company developing primefaces, and recently we as users have seen a very good synergy, where if there is an improvement in one component is then ported to the other library.
  • Right now (2016) primefaces has more components than primeng and feels more polished

使用primeng + JSF(primefaces)的含义:

Implications of using primeng + JSF (primefaces):

  • 每个框架都有不同的生命周期,具有不同的概念和含义(假设一个框架是客户端,另一个框架是服务器端),如果您开始使用这两个框架,则必须 了解它们非常详细.
  • 如果您开始混合使用两个框架的组件,那么将很难维护
  • Each framework has different lifecycles with different concepts and implications (given that one is client-side and the other is server-side), if you start to use both frameworks you have to understand them at great detail.
  • If you start mixing components of both frameworks this is going to be very hard to maintain

其他方法:

  • primeng + JAX-RS:假设您正在使用wildfly,这将很容易实现,所有服务都将信息提供给客户端组件.它往往是现代"方法.
  • JSF + primefaces:这是最简单的解决方案,仅服务器端,仅需学习一个框架.
  • 仅将JSF用作模板引擎(facelets),并在其顶部使用angular2 + primeng:是的,这可能有效,但需要进行更多的研究才能使其正确运行,您需要真正了解angular2生命周期并不是不可能,但需要时间.
  • primeng + JAX-RS: Given that you are using wildfly this will be easy to implement, all services provide the info to the client components. It tends to be the 'modern' approach.
  • JSF + primefaces: this is the simplest solution, only server side, only one framework to learn.
  • use JSF only as a template engine (facelets) and on top of it use angular2 + primeng: yes, this could work but needs more investigation to make it properly, you need to really understand JSF and angular2 lifecycles, is not impossible but requires time.

关于您关于npm的其他问题:是的,您可以不使用npm使用angular2,但是您将需要编写更多的样板代码,您可以使用此代码块作为起点(您需要添加primeng的js文件): http://plnkr.co/edit/bApfY9? p = info .

As for you other question about npm: Yes, you can use angular2 without npm, but you will need to write more boilerplate code than necessary, you can use this plunker as starting point (you need to add the js file for primeng): http://plnkr.co/edit/bApfY9?p=info.

更新1: 我曾经读到JSF正计划实施生命周期阶段以执行javascript代码.暂无官方声明.

Update 1: I once read that JSF was planning to implement a lifecycle phase to execute javascript code. No official statement by now.

这篇关于没有npm,可以使用JSF中嵌入的Primeng,Angular2吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆