These are chat archives for AngularClass/NG6-starter

6th
Jan 2016
Brian Vogelgesang
@KidA001
Jan 06 2016 00:13
why does this starter wrap $scope into vm for the controller? And where can I inject other dependencies into the controller?
Andy Brown
@brownish
Jan 06 2016 00:13
you don't need $scope
it's using the controllerAs syntax
you can inject dependencies into the controller right into the constructor
Brian Vogelgesang
@KidA001
Jan 06 2016 00:14
Like so with restangular?
class AboutController {
  constructor(restangular) {
    this.name = 'about';
  }
}

export default AboutController;
Andy Brown
@brownish
Jan 06 2016 00:15
class AboutController {
  constructor(restangular) {
    this.name = 'about';
    this.restangular = restangular;
  }
  onClick(){
    this.restangular.dosomething();
  }
}

export default AboutController;
in your html you can use onClick with vm.onClick()
Brian Vogelgesang
@KidA001
Jan 06 2016 00:16
What is the benefit of wrapping everything from the controller into vm?
Andy Brown
@brownish
Jan 06 2016 00:17
well i really like the es6 features that are used in ng6-starter
Sergey Protko
@fesor
Jan 06 2016 00:29
@KidA001 are you about controllerAs?
read angular-styleguide for details. This allows you decouple from $scope and aliminate some nasty bugs with scope inheritance.
Andrew Lombardi
@kinabalu
Jan 06 2016 00:39
@brownish how are you liking using angular-material
Andy Brown
@brownish
Jan 06 2016 00:40
i like it
Andrew Lombardi
@kinabalu
Jan 06 2016 00:40
Seems like a more modern look than bootstrap
Craig Shearer
@craigsh
Jan 06 2016 00:40
I'm using angular material too. I like it a lot - it's quite beautiful but there's a few holes that need to be filled.
e.g. date picker is buggy and limited at the moment, but they're working on it.
Andy Brown
@brownish
Jan 06 2016 00:41
yeah it's real nice but there are a lot of missing features
Andrew Lombardi
@kinabalu
Jan 06 2016 00:42
Bummer. Seems to be different from integrating bootstrap right? No actual module to integrate ...
Craig Shearer
@craigsh
Jan 06 2016 00:43
Yes, there's a module...
import material from 'angular-material'
then...
let appModule = angular.module('app', [
  material,
  'ui.router',
  uiMask,
...
Andrew Lombardi
@kinabalu
Jan 06 2016 00:44
Ahh so no need to modify the index
Craig Shearer
@craigsh
Jan 06 2016 00:44
Yes
Joe Gatt
@joegatt
Jan 06 2016 07:31
@fesor thanks for filter example. Will try it out.