Registry / web-framework / ngVue
library2.2.1jsnpmunverified

ngVue is a JavaScript module designed to integrate Vue 2 components within AngularJS 1.x applications. It provides a bridge, enabling developers to use Vue's reactive data binding and component-based architecture within existing Angular 1.x codebases. This allows for a gradual migration of view layers from Angular 1.x to Vue 2, addressing common performance bottlenecks related to Angular's scope watchers and offering a more predictable one-way data flow. The current stable version is 2.2.1. While the project sees occasional maintenance releases to address minor issues and improve compatibility (e.g., ESM support), its primary use case targets older, established Angular 1.x applications rather than new development. Key differentiators include its `vue-component` directive and `createVueComponent` factory, specifically tailored for interop between these two legacy frameworks. For Vue 3 support, users are explicitly directed to use the separate `ngVue3` package.

npm install ngVue
INSTALL
IMPORT
SIG · NGVUE
N
ngVue
web-frameworkjavascriptv2.2.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ngVue (module registration)
import 'ngVue'; angular.module('yourApp', ['ngVue']);
const ngVue = require('ngVue'); angular.module('yourApp', [ngVue]);
The `ngVue` package exports itself as an Angular module that registers globally when imported/required. The Angular application then depends on the string literal `'ngVue'`.
createVueComponent
import { createVueComponent } from 'ngVue';
import createVueComponent from 'ngVue';
This factory is a named export, typically injected into Angular services or controllers to programmatically convert Vue component definitions into Angular-compatible directives.
ngVueReduxPlugin (example)
import 'ngVue/plugins/redux'; angular.module('yourApp', ['ngVue', 'ngVueReduxPlugin']);
import { ngVueReduxPlugin } from 'ngVue/plugins/redux';
Specific plugins, like the Redux integration, often register themselves as separate Angular modules and are imported for their side-effects, making their module name available for Angular dependency.

Demonstrates how to integrate a Vue 2 component into an AngularJS 1.x application using `ngVue`, passing props and handling events.

import angular from 'angular'; import Vue from 'vue'; import 'ngVue'; // Define a simple Vue component const MyGreetingComponent = { template: ` <div> <h3>Hello from Vue!</h3> <p>{{ message }}</p> <button @click="emitEvent">Click me (Vue)</button> </div> `, props: ['message'], methods: { emitEvent() { this.$emit('vue-clicked', 'Hello from Vue event!'); } } }; // Register ngVue and define the Angular app angular.module('myApp', ['ngVue']) .controller('MyController', function($scope, $rootScope, createVueComponent) { // Expose the Vue component to ngVue via $rootScope.components // This is a common pattern for ngVue to find components by name $rootScope.components = { MyGreetingComponent: MyGreetingComponent }; $scope.angularMessage = 'Data from Angular scope.'; $scope.vueData = { message: 'This prop is passed from Angular to Vue.' }; $scope.vueEvents = { 'vue-clicked': function(payload) { console.log('Vue component clicked! Payload:', payload); alert('Vue component received event: ' + payload); } }; }); // To use in HTML (assuming an index.html file): // <div ng-app="myApp" ng-controller="MyController"> // <h2>Angular App with Vue Component</h2> // <p>Message from Angular: {{ angularMessage }}</p> // <vue-component name="MyGreetingComponent" v-props="vueData" v-on="vueEvents"></vue-component> // </div>
Debug
Known issues
breakingngVue is specifically designed for Vue 2 and AngularJS 1.x. For applications targeting Vue 3, users *must* switch to the separate `ngVue3` package, as `ngVue` is not compatible with Vue 3.
fix
If migrating to Vue 3, install `@jaredmcateer/ngvue3` and refactor component integration accordingly. Do not attempt to use `ngVue` with Vue 3.
affects: >=1.0.0
breakingEarlier versions of ngVue (2.0.0 to 2.1.0) had incomplete or broken ESM (ECMAScript Module) support, which could lead to build failures or runtime errors when bundling with modern tools. This was primarily due to incorrect `exports` field in `package.json`.
fix
Upgrade to `ngVue@2.2.0` or later for significantly improved and more robust ESM compatibility. If stuck on an older version, consider using CommonJS imports or a bundler configuration that specifically handles legacy module formats.
affects: >=2.0.0 <2.1.1
gotchaVersion 2.0.0 introduced support for Vue 2 Composition API. While described as having no *expected* breaking changes, this was a significant internal refactor. Existing components or integrations might exhibit subtle behavioral differences or require minor adjustments if they relied on specific internal behaviors of `ngVue` before this update.
fix
Thoroughly test applications when upgrading from `ngVue` versions prior to 2.0.0, especially those using complex component interactions or the Vue 2 Composition API features.
affects: <2.0.0
gotchaVersions of `ngVue` prior to 1.7.8 had a known memory leak issue related to the mounted lifecycle hook of Vue components, which could cause performance degradation in long-running Angular 1.x applications with a high turnover of Vue components.
fix
Upgrade `ngVue` to version 1.7.8 or later to resolve the memory leak issue.
affects: <1.7.8
deprecatedBefore version 2.2.1, a deprecation warning related to camelCase event naming styles could appear during bootstrapping. Although the specific warning was removed, it's generally best practice to use kebab-case for custom events in Vue components exposed through `ngVue` to ensure consistency and avoid potential issues with HTML attribute parsing.
fix
Ensure all custom events emitted by Vue components integrated with `ngVue` are defined and emitted using kebab-case (e.g., `my-event`) rather than camelCase (e.g., `myEvent`).
affects: <2.2.1
Errors
Common errors & fixes
Uncaught ReferenceError: process is not defined
ngVue versions prior to 1.7.5 attempted to access the Node.js `process` global in browser environments, leading to errors.
fix
Upgrade `ngVue` to version 1.7.5 or later. If using an older version and a bundler, ensure `process` is properly polyfilled or mocked for browser builds.
Uncaught TypeError: e.warn is not a function
This error occurred in `ngVue` versions prior to 1.7.4 when the internal logger attempted to call a `warn` method on an object that did not have it defined.
fix
Upgrade `ngVue` to version 1.7.4 or later to fix the logger initialization logic.
Upgrade
Version history
2.2.1latest on npm
Audit
Dependencies
angularrequiredProvides the host AngularJS 1.x environment.
vuerequiredProvides the Vue 2 component rendering capabilities.
Agent activity
6 hits · last 30 days
node
6
Resources
ngVue — npm install ngVue · libregistry