Je structure de répertoire comme:erreur XHR 404 lors de l'importation module de noeud - angulaire 2
dir
|--app.component.ts
node_modules
|--angular2-bootstrap-switch
Je suis https://www.npmjs.com/package/angular2-bootstrap-switch ajouter interrupteur angular2-boostrap et selon les instructions, je devais faire, mais ain' t sûr comment.
index.html:
<script src="node_modules/es6-shim/es6-shim.min.js"></script>
<script src="node_modules/systemjs/dist/system-polyfills.js"></script>
<script src="node_modules/angular2/bundles/angular2-polyfills.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="node_modules/rxjs/bundles/Rx.js"></script>
<script src="node_modules/angular2/bundles/angular2.dev.js"></script>
<!-- 2. Configure SystemJS -->
<script>
System.config({
packages: {
app: {
format: 'register',
defaultExtension: 'js'
}
}
});
System.import('app/boot')
.then(null, console.error.bind(console));
</script>
</head>
<!-- 3. Display the application -->
<body>
<my-app>Loading...</my-app>
</body>
boot.ts intérieur
import {bootstrap} from 'angular2/platform/browser'
import {AppComponent} from './app.component'
bootstrap(AppComponent);
DANS tsconfig.json
"exclude": [
"node_modules",
"typings/main",
"typings/main.d.ts"
]
Maintenant, je dois importer ../node_modules/angular2_bootstrap_switch/components à l'intérieur de app.component.ts, comme:
import {SwitchComponent} from angular2_bootstrap_switch/components
Je ne sais pas comment. S'il vous plaît aider.
HI, merci pour vos efforts. Je suis confronté à un problème ici. Premièrement j'ai fait npm installer angular2-bootstrap-switch et fait la plupart des étapes. J'ai eu XHR 404 pendant le chargement de l'interrupteur. Plus tard, j'ai désinstallé angular2-bootstrap-switch et puis npm je angular2-bootstrap-switch et maintenant je ne peux pas trouver le module angular2-bootstrap-switch. Je ne suis pas sûr de ce qui est si poisson, S'il vous plaît clarifier. – Gayathri
êtes-vous disponible dans teamviewer? – Aravind
Oui j'ai mais c'est pour une startup. Est-ce bien? – Gayathri