In the view I'm declaring the controller like so:
<div data-ng-controller="myController as myCtrl">
{{myCtrl.selectedMonth}}
</div>
I want to be able to access a month in the view, but I don't want the date object to be accessible from the view. Would this do it? Is testabc accessible from the view? Is this a good way to have privately scoped variables on the controller?
;(function() {
'use strict';
angular
.module('myApp')
.controller('myController', myController);
function myController() {
var testabc = 'can you see this';
var dateRef = new Date();
var vm = this;
angular.extend(vm, {
selectedMonth: undefined
});
init();
function init(){
vm.selectedMonth = dateRef.getMonth();
}
}
}());