Skip to content

Instantly share code, notes, and snippets.

@justinyoo
Created March 22, 2017 04:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinyoo/f16fc1479b2071fde8a2fd5cddbc4c2a to your computer and use it in GitHub Desktop.
Save justinyoo/f16fc1479b2071fde8a2fd5cddbc4c2a to your computer and use it in GitHub Desktop.
Using IoC Container in Vue.js and TypeScript App
<template>
...
</template>
<script lang="ts">
import Vue from "vue";
import Component from "vue-class-component";
import SERVICE_IDENTIFIER from "./models/Identifiers";
import container from "./configs/DependencyConfigs";
@Component({
name: "App",
// Provides IoC container at the top level of VueComponent
provide: {
[SERVICE_IDENTIFIER.CONTAINER]: container
}
})
export default class App extends Vue {
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment