Given the following Plunker: http://plnkr.co/edit/YicBDARAf5umI0PdCL8L?p=preview
Why isn't $scope.someVal being set in the directive controller?
I would expect the output of the template to show
someVal = ABC controllerVal=DEF
but instead it shows
someVal = 123 controllerVal=DEF
Html:
<html>
<head>
<script data-require="angular.js@1.2.25" data-semver="1.2.25" src="https://code.angularjs.org/1.2.25/angular.js"></script>
</head>
<body ng-app='myApp'>
<my-test some-val="123"></my-test>
<script>
angular.module("myApp", [])
.directive("myTest", function() {
return {
restrict: "E",
scope: {
someVal: "@"
},
template: "someVal = {{someVal}} controllerVal={{controllerVal}}",
controller: function($scope) {
$scope.someVal = "ABC";
$scope.controllerVal = "DEF";
}
}
});
</script>
</body>
</html>