Created
July 28, 2014 10:19
-
-
Save escapedcat/9cdbabd0472646cc6cef to your computer and use it in GitHub Desktop.
basic webpack angularjs example, based on phonecatApp tutorial (phonecat)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var phonecatAnimations = require("./animations.js"); | |
var phonecatControllers = require("./controllers.js"); | |
var phonecatFilters = require("./filters.js"); | |
var phonecatServices = require("./services.js"); | |
'use strict'; | |
/* App Module */ | |
var phonecatApp = angular.module('phonecatApp', [ | |
'ngRoute', | |
'phonecatAnimations', | |
'phonecatControllers', | |
'phonecatFilters', | |
'phonecatServices' | |
]); | |
phonecatApp.config(['$routeProvider', | |
function($routeProvider) { | |
$routeProvider. | |
when('/phones', { | |
templateUrl: 'partials/phone-list.html', | |
controller: 'PhoneListCtrl' | |
}). | |
when('/phones/:phoneId', { | |
templateUrl: 'partials/phone-detail.html', | |
controller: 'PhoneDetailCtrl' | |
}). | |
otherwise({ | |
redirectTo: '/phones' | |
}); | |
}]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en" ng-app="phonecatApp"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Google Phone Gallery</title> | |
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css"> | |
<link rel="stylesheet" href="css/app.css"> | |
<link rel="stylesheet" href="css/animations.css"> | |
<script src="js/bundle.js"></script> | |
</head> | |
<body> | |
<div class="view-container"> | |
<div ng-view class="view-frame"></div> | |
</div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var jquery = require("../bower_components/jquery/jquery.js"); | |
var angular = require("../bower_components/angular/angular.js"); | |
var ngAnimate = require("../bower_components/angular-animate/angular-animate.js"); | |
var ngRoute = require("../bower_components/angular-route/angular-route.js"); | |
var ngResource = require("../bower_components/angular-resource/angular-resource.js"); | |
var phonecatApp = require("./app.js"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
entry: './app/js/main.js', | |
output: { | |
filename: './app/js/bundle.js' | |
} | |
}; |
I'm also getting same error as " app is not defined"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, please an example of controller.
why do you give me this error:
Uncaught ReferenceError: app is not defined
My controller:
app.controller ('login', ['$scope', '$window', '$rootScope', '$http', 'AuthenticationService', function ($scope, $window, $rootScope, $http, AuthenticationService) {
}]);