2

I would like to use Angular with non-DOM view (using Pixi.js), so I need to instantiate controller manually (analogical to ng-controller attribute), I found something like:

$controller('MyController', {$scope: $scope}));

but it suppose I have already $scope created.

Note: I know Angular is mainly aimed to use DOM element, but for Pixi, it could be a little bit similar, I would use $watch and $apply for attributes like x, y, alpha etc. Thanks.

sitnarf
  • 407
  • 2
  • 9
  • 1
    `angular.module('myApp',[]).controller('myCtrl',function($scope){})` – topheman Dec 22 '14 at 22:18
  • 1
    Angular's concept of scope is integrally tied to the DOM — see http://stackoverflow.com/questions/16587961/is-there-already-a-canvas-drawing-directive-for-angularjs-out-there for a tangential discussion around dealing with canvas in an Angular way – Mark Fox Dec 22 '14 at 22:19

1 Answers1

0

The most straightforward way to do this is like this:

angular.module('<module-name>', [])
    .controller('MyController', function ($scope) {
        ...
    });
alexsomeoddpilot
  • 200
  • 1
  • 12