dimanche 17 septembre 2017

Why does my controller isn't matching with view?

I'm new to angular/jade and i can't understand why does my controller isn't working in my view, i can't use my variable set in my controller.

Here is the controller code :

angular.module 'app'

.controller "DirectoryGridCtrl", ($scope, Refs) ->

  ################################################################################
  # actions                                                                      #
  ################################################################################

  ################################################################################
  # onLoad                                                                       #
  ################################################################################

  $scope.test = "Test"

  ################################################################################
  # constructor grid                                                             #
  ################################################################################

  @grid = new Grid(resource: Directory, ctrlName: 'directoryGrid')

  ################################################################################
  # return                                                                       #
  ################################################################################
  return

I've tried with vm.test, test, scope.test, $scope.test, etc..

Here is the route :

angular.module 'app'

.config ($stateProvider) ->

  $stateProvider
    .state 'app.directory.grid',
      url: ''
      templateUrl: 'app/modules/directory/grid/directory-grid.html'
      controller: "DirectoryGridCtrl as vm"

Here is where i'm trying to use it but it is never printed :

  
  

Should i create other files? Or am i doing something wrong?

Thanks,

Nicolas




Aucun commentaire:

Enregistrer un commentaire