I want o get the value of and attribute in my angular controller but it is undefined. If it helps everything is inside an MVC.net application.
The simplified codes:
TestCtrl.js:
angular.module('CMM')
.controller('TestCtrl', ['$scope', '$element', '$attrs', function ($scope, elem, $attrs) {
$scope.name = "mohsen";
$scope.api = $attrs.api;
alert($attrs.api);
alert(elem.data('api'));
console.log('hi, I am here');
}]);
app.js:
var app = angular.module('CMM', ['ngRoute','slServices', 'slControllers', 'ngAnimate', 'smart-table', 'ui.bootstrap']);
.....
usage:
<div id="content" ng-controller="TestCtrl">
<h3>
<input type ="text" ng-model="name"/>
<input type="text" ng-model="api" api="/sl/asdf"/>
....