I try it like bellow but result is "undefined"
Please help me
Here is code :
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<body>
<div ng-app="myApp" ng-controller="myCtrl" ng-init="carname='Volvo'">
<h1>{{carname}}</h1>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
//I want to get value of $scope.carname here
alert($scope.carname);
});
</script>