2

This is index.html file

<!doctype html>
<html ng-app="mm">
<head>
    <title>Country page</title>
    <script src="js/angular.js"></script>
    <link href="js/bootstrap.css" rel="stylesheet" />
    <link href="js/bootstrap-theme.css" rel="stylesheet" />
    <link href="css/style.css" rel="stylesheet" />
    <script src="app.js"></script>
    <style>
        .box {
            margin:0px auto;
            width: 400px
        }

    </style>
</head>
<body>
    <div class="box" ng-controller="mc">
        <p ng-if="bool">Hello!!!</p>
    </div>
</body>
</html>

This is app.js file

var mm = angular.module('mm', []);
var mc = mm.controller('mc', function ($scope){
    $scope.bool = false;
});

I am very beginer at AngularJS and I am confused why "Hello!!!" still on my page but my bool variable is "false".

2
  • Your code is working. AngularJS is not loaded! Commented Jul 6, 2015 at 19:35
  • which version of angular are you using in this example? Commented Jul 6, 2015 at 19:57

3 Answers 3

1

You are doing correctly everything, May be you should check if angular is loaded, (with console.log(angular) ).

It does work for me: https://jsfiddle.net/shimonb/h44rduky/3/

Sign up to request clarification or add additional context in comments.

Comments

1

Try to change your tag to <div ng-show="bool">Hello!!</div>

Comments

0

I just set up AngularJS version 1.4.2 and now everything is ok! Thanks all for help!

Comments

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.