I am using Autodesk Forge Viewer (v7.37) in a create react app (v4.0.2) and Typescript.
When I run the command npm run test I got the following error:
● Test suite failed to run
ReferenceError: Autodesk is not defined at:
export default class AssetListPanelExtension extends Autodesk.Viewing.UI.DockingPanel {
Thanks for your help.
Are you adding the reference scripts?
<!-- Autodesk Forge Viewer files -->
<link rel="stylesheet" href="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/style.min.css" type="text/css">
<script src="https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/viewer3D.min.js"></script>
Related
Working in a angular4 application and can't able to load the application in IE. I am using the following versions.
Node -v7.2.1
npm -v3.10.10
typescript- v2.2.1
Webpack -v2.2.1 and using ES6 module in tsconfig.json
#angular/core 4.0.0
How to load angular2 app in IE.
Thanks in advance
try to add to your index.html (top of the head tag):
<script src="https://raw.githubusercontent.com/angular/angular/66df335998d097fa8fe46dec41f1183737332021/shims_for_IE.js" type="text/plain"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.5.9/es5-sham.js" type="text/plain"></script>
<meta http-equiv="X-UA-Compatible" content="IE=9;IE=edge;IE=10" />
I am writing a WebRTC application and have the following problem:
I want to use the adapter.js library.
I have the following index.html:
<html>
<header>
<script src='../out/adapter.js'></script>
<script src='../out/main.js'></script>
</header>
<body>
<video id="localVideo" width='500' autoplay></video>
</body>
</html>
and my main.js looks like:
var adapter=require('webrtc-adapter');
var localVideo=document.querySelector('video#localVideo');
navigator.getUserMedia(media_constraints, handleUserMedia, handleUserMediaError);
function handleUserMedia(stream) {
localStream = stream;
adapter.attachMediaStream(localVideo, stream);
console.log('Adding local stream.');
}
but my browser logs the error: Uncaught ReferenceError: require is not defined
require is used (and defined) in Node.js environments to load modules. (Not exclusively, for more information check here).
If you downloaded an adapter.js version from here and include it the way you do (via script tags), you can simple delete the require(...) line and you should be good to go.
Edit: added an example
console.log(adapter.browserDetails.browser);
<script src="http://webrtc.github.io/adapter/adapter-latest.js"></script>
if you have checked installing adapter js?
check
npm webrtc-adapter --version
if not showing up in node, install it to your app
npm install --save webrtc-adapter
Here is my project structure
helloWorld
-app
--package.json
--app.js
--node_modules
--public
---index.html
---package.json
---node_modules
-dist
-build
-package.json
I am running the index.html on localhost made using nodejs in electron.
I want to use persistent cookies in Electron app. In order to do this, I am using electron-cookies but I am getting Cannot find module 'electron-cookies'
I have installed electron-cookies in app>>package.json and app>>public>>package.json as well but nothing seems to be working.
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<script>
require('electron-cookies')
</script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.1/angular.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.1/angular-cookies.min.js"></script>
<meta charset="utf-8">
<title>AngularJS Cookies Example</title>
</head>
End of the day my task is to create cookies, please suggest if there is any alternative that can create persistent cookies.
You can use the native Electron Cookies interface. The electron-cookies third party lib you're trying to load seems a little out of date and is probably no longer working with current versions of Electron.
I am taking baby steps into the MEAN stack but can't figure out step 1, how to run my app. What do I use for a development web server and how do I start it in my directory?
If I just launch index.html as a file it will not work.
Here is my code
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="utf-8">
<title>My Site</title>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.min.js"> </script>
<link rel="stylesheet" href="style.css">
<script>
document.write('<base href="' + document.location + '" />');
</script>
<script src="app.js"></script>
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/3.2.1/css/bootstrap-combined.min.css"
rel="stylesheet">
</head>
<body ng-app="myApp" ng-controller="MainCtrl">
<a class="btn" ng-click="visible = true">Show the Form</a>
<div ng-show="visible">I used to be hidden!</div>
</body>
</html>
app.js
var app = angular.module( 'myApp', [] );
app.controller( 'MainCtrl', function( $scope ) {
$scope.visible = false;
});
If you simply want to explore AngularJS functionality(or any other front end library for that matter), you don't need a Node.js app.
Assuming you already have npm installed just follow these simple steps:
npm install http-server -g
go from your console to the folder containing your html files
enter http-server -c-1 -p 9000
That would start a simple web server on port 9000 with no caching on your specified directory.
Then simply go to http://0.0.0.0:9000/your_page.html from a browser and voila.
If you want to explore more options on http-server
This code can run without a http server, just in the browser. Note that you are using a really outdated version of Angular (1.0.3), they just released version 1.3.0.
If you want to run your stuff on a local development server, you could use something like yeoman, which generates the app boilerplate for you and comes with a local node server and a build job (check for example https://github.com/yeoman/generator-webapp or https://github.com/yeoman/generator-gulp-webapp)
If you just want a super easy hhtp server and have python installed you can also use python -m SimpleHTTPServer to start up an http server in the current folder.
Here is your code in plunker and it works: http://plnkr.co/edit/j2SqmrP1yWqR68Gm3UCn?p=preview
As you are using the MEAN stack, you should probably check node.js to implement your web server. Check http://www.nodebeginner.org/, it should allow you to code a very simple one.
Posting here as requested original post can be found here
Hello, I would like to build ember.js using Ubuntu 13.
I have cloned the official Github project, cd into the project and as described in the readme file I did:
bundle install
rake dist
no error is shown on screen and as a result I get a directory shown in the image
I would like to use ember and ember-data, so I include
ember.js
ember-data-deps.js
files in my test project.
The problem is that I am getting a TypeError: App.Router is undefined
I am using this at my client.js file to init ember
this.App = Ember.Application.create();
App.Router.map(function() {
this.route('contributors');
this.route('contributor', {path: '/contributors/:contributor_id'});
});
Am I doing something wrong in the build process?
Should I include some other js files in my project?
Thank you in advanced.
The TypeError: App.Router is undefined error is because ember.js is not loaded correctly or in the correct order.
To get ember-data (that is separate from ember.js) you have to clone this repo (https://github.com/emberjs/data) and follow the build instructions in the readme file, it's straight forward, and once you have the dist directory from the ember-data build process get the file ember-data.js development version or ember-data.min.js for production (well, production... ember-data is still considered unstable for production environments).
here is a simple ember project setup using ember-data:
index.html
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>ember app</title>
</head>
<body>
<script type="text/x-handlebars">
hello world!
</script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<script type="text/javascript" src="http://builds.emberjs.com.s3.amazonaws.com/handlebars-1.0.0-rc.3.js"></script>
<script type="text/javascript" src="http://builds.emberjs.com.s3.amazonaws.com/ember-latest.js"></script>
<script type="text/javascript" src="http://builds.emberjs.com.s3.amazonaws.com/ember-data-latest.js"></script>
<script type="text/javascript" src="app.js"></script>
</body>
</html>
app.js
var App = Ember.Application.create({
ready: function () {
console.log("app started...");
}
});
hope it helps