M
M
MakPET2016-03-09 17:46:14
JavaScript
MakPET, 2016-03-09 17:46:14

Why is this script not working?

<!DOCTYPE html>
<html lang="en" ng-app="helloWorldApp">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.min.js"></script>
  <script>
    
  var model = "Hello World";
  
  var helloWorldApp = angular.module("helloWorldApp",[])

  helloWorldApp.controller("helloWorldCtrl",function($scope){
    $scope.message = model;
  })

  $scope.func = function($scope){
    $scope.message = $scope.text
  }

  </script>
</head>
<body ng-controller="helloWorldCtrl">
  
  <h1>{{message}}</h1>
  <input type="text" ng-model="text">
  <button ng-click="func()">Send</button>

</body>
</html>

everything works in the video

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2016-03-09
@MakPET

It can't possibly work.
$scope.func isn't even in the controller.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question