I'm trying to use Phantom JS in Meteor JS.
Previously I have had issues using npm packages so it is possible I am approaching things in the completely wrong way. I referenced the Meteor guide and they suggest you import the package like I have done. Unfortunately when I uncomment line 4 I get this error:
angular_angular.js?hash=c17a5a9…:83 Uncaught Error: [$injector:modulerr] Failed to instantiate module info due to: Error: [$injector:nomod] Module 'info' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
Here is my code:
import angular from 'angular';
import angularMeteor from 'angular-meteor';
import ngMessages from 'angular-messages';
// import phantomjsWrapper from 'phantomjs-wrapper';
angular.module('info', [
angularMeteor, 'ngMaterial', 'ngMessages'
])
.controller('SearchCtrl', SearchCtrl)
.controller('ContentCtrl', ContentCtrl)
.controller('BtnCtrl', BtnCtrl)
function SearchCtrl($timeout, $q, $scope, $rootScope) {
var self = this;
self.selectedItem = null;
self.searchText = null;
self.querySearch = querySearch;
console.log(self.searchText)
}
function ContentCtrl($rootScope) {
$rootScope.hidestatus = true;
phantomjsWrapper({
timeout: 60000
}, function(err, phantomjs) {
phantomjs.createPage(function(err, page) {
page.open('http://www.google.com', function(err) {
page.on('alert', function(msg) {
console.log('Alert:', msg);
});
page.once('loadFinished', function() {
page.render('google-reloaded.png', function() {
page.close(function() {
phantomjs.close(function() {
console.log('done!');
});
});
});
});
page.evaluateJavaScript('(function() { alert("hello!"); })');
page.includeJs('http://code.jquery.com/jquery-2.0.3.min.js', function() {
page.evaluateJavaScript('(function() { $("a").remove(); })');
page.render('google-no-anchors.png', function() {
page.reload();
});
});
});
});
});
}
In the process of implementing this npm package, what mistakes am I making.
