javascript
Convert a 3D model to JSON with Three.JS library
Problem
Converting a given 3D model (a .obj file) to JSON format
Solution
Three js has its own converter now
requirements
The converted location in source code
https://github.com/mrdoob/three.js/tree/dev/utils/converters
How to set selected="selected" in VueJS
Problem: I have a select element. The options are populated using an array and while populating the select element I want to also set the selected value. How do I do this.
Solution
use v-bind:se;ected OR :selected with a boolean expression that returns TRUE or FALSE. If it returns TRUE that will be the selected value. See example below
Passing data within your controllers
/** * Created by nmeegama on 8/27/16. */ /************ Controller to set the data *******************/ (function (angular) { 'use strict'; angular.module('MyApp').controller('SetDataCtrl', [ '$scope', 'MyService', function ($scope, MyService) { $scope.setData = function (data) { MyService.setData(data); }; }]); })(angular); /************ Controller to get the data *******************/ (function (angular) { 'use strict'; angular.module('MyApp').controller('GetDataCtrl', [ '$scope',
Getting rid of the CORS error with NodeJS
Ideally what I am trying to solve here is an error that usually occurs when you are trying to server data to a different domain. You will usually get an error saying something similar to the below
Cross-Origin Request Blocked
So how do we now get rid of this assuming we are using a NodeJS server to serve the data. Easy we just add the cors module. SO here is the code