Last active
September 29, 2015 18:28
-
-
Save erickzanardo/f3e8882209be24ee9745 to your computer and use it in GitHub Desktop.
Angular stand alone test
This file contains hidden or 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
(function() { | |
var existingAngular = window.angular; | |
require("angular"); | |
var angular = window.angular; | |
window.angular = existingAngular || {}; | |
module.exports = angular; | |
})(); |
This file contains hidden or 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
<html> | |
<head> | |
<script type="text/javascript" src="app-angular.js"></script> | |
</head> | |
<body> | |
<p ng-controller="ExampleController"> | |
{{name}} | |
<button ng-click="sayMyName()"> Say my name </button> | |
</p> | |
</body> | |
<script type="text/javascript"> | |
if(!window.angular) { | |
alert("There is no Angular"); | |
} | |
</script> | |
</html> | |
This file contains hidden or 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
{ | |
"name": "browserifytest", | |
"version": "0.0.0", | |
"description": "", | |
"main": "", | |
"moduleType": [], | |
"license": "MIT", | |
"homepage": "", | |
"ignore": [ | |
"**/.*", | |
"node_modules", | |
"bower_components", | |
"test", | |
"tests" | |
] | |
} |
This file contains hidden or 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 = function(app) { | |
app.controller("ExampleController", ["$scope", function($scope) { | |
$scope.name = "Bond, James Bond"; | |
$scope.sayMyName = function() { | |
alert($scope.name); | |
}; | |
}]); | |
}; |
This file contains hidden or 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
(function() { | |
var angular = require("./angular-noconflict.js"); | |
var app = angular.module("angular-poc", []); | |
require("./example-controller.js")(app); | |
angular.element(document).ready(function() { | |
angular.bootstrap(document, ["angular-poc"]); | |
}); | |
})(); |
This file contains hidden or 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
{ | |
"name": "browserifytest", | |
"version": "1.0.0", | |
"description": "", | |
"main": "main.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "ISC", | |
"dependencies": { | |
"angular": "^1.4.6" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment