Мой webpack.config
var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: "./main.js", //relative to root of the application
output: {
path: __dirname,
filename: "app.bundle.js" //relative to root of the application
},
watchOptions: {
aggregateTimeout: 300,
poll: 1000
},
plugins: [
new HtmlWebpackPlugin({
hash: true,
title: 'My Awesome application',
myPageHeader: 'interviewee',
template: './_index.html',
filename: 'index.html' //relative to root of the application
})
]
}
main.js
let jquery = require("./Scripts/jquery-1.9.0.js");
let angular = require("./Scripts/angular.js");
let ngRoute = require("./Scripts/angular-route.js");
let bootstrap = require("./Scripts/bootstrap.js");
let appController = require("./app.controller.js");
let addController = require("./add.controller.js");
let service = require("./service.js");
let messages = require("./Scripts/angular-messages.js")
app.controller
var MyApp = angular.module("MyApp", [
'ngRoute',
'ngMessages',
'IntervieweeService'
]
);
MyApp.config(['$routeProvider',
function ($routeProvider) {
$routeProvider.
when('/Add', {
templateUrl: 'Views/add.html',
controller: 'AddController'
}).
otherwise({
redirectTo: '/Home'
});
}]
);
add.controller
MyApp.controller("AddController", function ($scope, EmpApi) { ....... }
Когда я запускаю приложение, я получаю «MyApp» не определено.Что я делаю неправильно?Я новичок в Webpack и Angularjs.Не могли бы вы показать мне, как мне это исправить тоже?Спасибо