Answer the question
In order to leave comments, you need to log in
The simplest application on Angular does not work?
Hello. I learn Angular by lessons. It is necessary that by clicking on the button, the value that is in the input is assigned to the name variable and displayed instead of Hello World! But something is not assigned to anything, help!
<!doctype html>
<html lang="en" ng-app="Application">
<head>
<meta charset="utf-8">
<title>Google Phone Gallery</title>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular.min.js"></script>
<script>
var moduleMain = angular.module("Application", []);
moduleMain.controller("Ctrl", function($scope) {
$scope.helloName = "Hello World"
$scope.name = $scope.helloName;
$scope.mainFunction = function() {
$scope.name = $scope.text;
}
})
</script>
</head>
<body>
<div ng-controller="Ctrl">
<h1>{{name}}</h1>
<input type="text" ng-model="text">
<input type="button" value="Press it!" ng-click="mainFunction">
</div>
</body>
</html>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question