I am using AngularJS with TypeScript and now I need to pass a parameter from view to controller. This is the way how I am trying to do it (via ng-init):
<div class="col-md-9" ng-controller="MapIZSController" ng-init="init('IZS')">
"IZS"
value should be passed to controller. The controller looks like:
export class MapIZSController
{
static $inject = ["$scope", "leafletData"];
private m_scope: IMapIZSScope;
private m_leafletData;
constructor($scope: IMapIZSScope, leafletData)
{
// the first way I tried
$scope.init = function (type) {
console.log("type is: " + type);
};
// the second way I tried
$scope.init = this.init;
}
public init = (init: any) => {
console.log("init is: " + init)
}
My problem is that I would like to obtain a type but
- the first way is never called and
- the second too.
Can you give me some advice please?