I am having trouble converting some Angular code. Currently, it is using Angular's $http service to get data from another file and display it on the page. I want it to still do this but with vm
instead of $scope
. Here's an example of my vain attempts to do this:
HTML
<h1>{{vm.welcome}}</h1>
Javascript
var app = angular.module('myApp', []);
app.controller('myCtrl', function() {
$http.get("welcome.htm")
.then(function(response) {
var vm = this;
vm.welcome = response.data;
});
});
Also, I originally got this code from w3schools' Angular tutorial.