0

this is html file

<!DOCTYPE html>

<html ng-app="myApp">

    <head>

        <title>BlogIt!</title>
        <script type="text/javascript" src="bower_components/angular/angular.min.js"></script>
        <script type="text/javascript" src="app.js"></script>
    </head>

    <body ng-controller="myCtrl">

        {{message}}

    </body>

</html>

this is js file

var app = angular.module('myApp', []);

app.controller('myCtrl', function($scope){

    $scope.message = "Welcome to BlogIt!";

})
10
  • Do you check your console where it gives error Commented Dec 6, 2017 at 7:25
  • 1
    You delcare angular module as myApp but where's ng-app in html ? you've to first define there. Commented Dec 6, 2017 at 7:28
  • Are you sure bower_components/angular/angular.min.js is correct path? Commented Dec 6, 2017 at 7:28
  • SPnl is right u have to define first ng-app then ng-controller Commented Dec 6, 2017 at 7:30
  • show the folder structure. Commented Dec 6, 2017 at 7:34

1 Answer 1

2

Edit with this :

<head>
    <title>BlogIt!</title>
    <script type="text/javascript" src="bower_components/angular/angular.min.js"></script>
    <script type="text/javascript" src="app.js"></script>
</head>
<body ng-app="myApp" ng-controller="myCtrl">
    {{message}}
</body>
Sign up to request clarification or add additional context in comments.

2 Comments

still getting the same result
This html and your script is correct. check that angular js file you loded or try with angular cdn.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.