As a new angular developer, I went through a few tutorials and built a few stand-alone or firebased angular practice apps, and thought I was getting a handle on the framework. I wanted to start a real app paired with a server and database, so I found a laravel powered angular stack on github:
https://github.com/jadjoubran/laravel5-angular-material-starter
To make a long story short, the code generated by this stack for angular controllers looks completely foreign to any angular I've seen:
class CreateStringFormController{
constructor(){
'ngInject';
//
}
}
I added
class CreateStringFormController{
constructor($scope){
'ngInject';
$scope.string = 'test';
$scope.stringed = $scope.string+'ed';
//
}
}
and my template:
<textarea rows="4" columns="50" class="form-control">{{string}}</textarea>
<h3>Parsed string: <span>{{stringed}}</span></h3>
The idea here is that when you type in the text area, the h3 below it outputs the value of the textarea+'ed' but the data binding is not working. On the page load the variables are set to 'test' and 'tested' as they should be, but typing doesn't update the value of the {{stringed}}. Even if I ditch everything in the controller and just put both the textarea and the h3 to be the same {{string}} it doesn't work.
If I wrap things in $scope.$watch then I get a "$digest already running" error. If anyone could point me in the right direction, that would rock. Also, if anyone could explain why this stack is using a constructor instead of just app.controller() like all the angularjs tutorials do, and using literally dozens of export/imports, that would be icing on the cake!
PS the files are .js, not .ts, not that I know what typescript is, but that has come up a lot in my googling.
Hope my question isn't too overly complicated! Thanks!