Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
angular-container
Advanced tools
[![NPM version](https://img.shields.io/npm/v/angular-container.svg)](https://www.npmjs.org/package/angular-container) ![](https://img.shields.io/npm/dm/angular-container.svg) ![](https://img.shields.io/github/last-commit/opteo/angular-container.svg) # Ang
Here at Opteo, we recently undertook the process of updating our large, Angular.js-based, front-end application (composed of many controllers, services and directives) to Vue. Migrating our entire application was expected to take several weeks (which later became months), so we built the angular-container Vue component as a simple way to use our existing Angular pages within our new Vue-based app.
.vue
componentsBy default, non curly braces are used for rendering angular-container $scope
variables, and instead square brackets are used (this can be overwritten).
The default is due to Vue using curly braces for data binding, which causes mounting issues and conflicts.
An installation of Angular.js is required for this component to work correctly. Install via yarn or npm:
yarn add angular angular-container
<template>
<AngularContainer ref="ng" name="user" ctrl="userCtrl">
<div ng-for="item in items">
<span ng-click="addItem()">[[ item ]]</span>
<!-- Existing custom Angular directives can be used -->
<blue>This users the "blue" directive</blue>
<!-- Vue variables can be used within the Angular instance -->
<span>{{ hello }}</span>
</div>
</AngularContainer>
</template>
<script>
import AngularContainer from "angular-container"
export default {
name: "User",
data() {
return {
hello: "world",
}
},
mounted() {
const angularContainer = this.$refs.ng
angularContainer.init() // Instantiate the Angular.js instance after Vue has mounted
const angularInstance = angularContainer.getInstance()
/* Use controllers, services and directives that you need */
angularInstance.service("userService", ["$injector", ($injector) => {
return {
getSomeData() {
return fetch("https://example.com/api/")
}
}
}])
// Controller
angularInstance.controller("userCtrl", ["$scope", "userService", ($scope, userService) => {
$scope.items = [1, 2, 3, 4, 5]
$scope.addItem = () => $scope.items.push(Math.random())
const data = await userService.getSomeData()
}])
// Directive
angularInstance.directive("blue", () => {
return {
restrict: "E",
transclude: true,
template: `<span style="color:blue;" ng-transclude></span>`
}
})
},
components: {
AngularContainer,
}
}
</script>
FAQs
[![NPM version](https://img.shields.io/npm/v/angular-container.svg)](https://www.npmjs.org/package/angular-container) ![](https://img.shields.io/npm/dm/angular-container.svg) ![](https://img.shields.io/github/last-commit/opteo/angular-container.svg) # Ang
We found that angular-container demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.