Simple AngularJS running on JSFiddle

后端 未结 7 1037
北海茫月
北海茫月 2020-11-27 16:55

How do I make a jsfiddle out of the following code:





    
7条回答
  •  北海茫月
    2020-11-27 17:58

    I am writing my answer for those who land on this page , I was used to use ng-module directive but in jsfiddle after half an hour I realized that ng-module is not allowed and you see no error , and when changed that ng-module to ng-app fiddle worked very well .I just wanted to share this .And no wrap (body) is required too.

    {{greeting}}


    var app=angular.module("appX",[]);
    console.log(app);
    app.controller("appCtrl",function($scope){
    $scope.greeting="Hello World";
    });
    

    https://jsfiddle.net/cloudnine/trgrjwf1/7/

提交回复
热议问题