I have posted below parts of a template, a directive, and a controller. They are all in different files. The controller runs fine and does its job. However, I have not been able to get the value of the attribute course (i…e., whether physics or chemistry) in the controller. Is there a way to do this?
Thanks.
<div>
<course-directive course="physics"></course-directive>
<course-directive course="chemistry"></course-directive>
</div>
angular
.module("myApp", [])
.directive("courseDirective", function() {
return {
scope: {
course: '='
},
templateUrl: "components/directives/courseDirective.html",
controller: controller
};
})
;
var controller = ["$scope", "$http", function ($scope, $http) {
// snipped code
}];