html - alert window not working with angular -


I have the following code in which I want to display a warning when clicking a button:

  & lt ;! DOCTYPE html & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Title & gt; & Lt; / Title & gt; & Lt; / Head & gt; & Lt; Body ng-app & gt; & Lt; Button ng-click = "alert ('test')" & gt; Display text & lt; / Button & gt; & Lt; Script src = "angular.min.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; Document.write ("& lt; base href = \" "+ document.location +" \ "/>"); & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; $ Scope.alert = function (variable) {warning (variable); }; & Lt; / Script & gt; & Lt; / Body & gt; & Lt; / Html & gt;   

This console is being displayed as an error: Uncounted ReferencesArray: $ scope is not defined

  & lt ;! DOCTYPE html & gt; & Lt; Html lang = "en" ng-app = "app" & gt; & Lt; Top & gt; & Lt; Title & gt; & Lt; / Title & gt; & Lt; / Head & gt; & Lt; Body ng-controller = "ModelCtrl" & gt; & Lt; Button ng-click = "alert ('test')" & gt; Display text & lt; / Button & gt; & Lt; Script src = "angular.min.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; Document.write ("& lt; base href = \" "+ document.location +" \ "/>"); & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; Var app = angular Module ('app', []); App.controller ('ModelCtrl', function ($ radius, $ http) {$ scope.alert = function (variable) {warning (variable);};}); & Lt; / Script & gt; & Lt; / Body & gt; & Lt; / Html & gt;    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -