user7496931
user7496931

Reputation:

Can't seem to load the AngularJS CDN?

So I'm following a Udemy tutorial to learn AngularJS (1) this is what I have for my HTML file:

<!DOCTYPE html>
<html lang="en-us" ng-app="myApp">
    <head>
        <title>Learn and Understand AngularJS</title>
        <meta http-equiv="X-UA-Compatible" content="IE=Edge">
        <meta charset="UTF-8">

        <!-- load bootstrap and fontawesome via CDN -->
        <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" />
        <!-- load angular via CDN -->
        <script src="//code.angularjs.org/1.3.0-rc.1/angular.min.js"></script>
        <script src="app.js"></script>
    </head>
    <body>
    <div class="container">
        <div ng-controller="mainController">
           <h1>Hello world!</h1>                
        </div>            
    </div>
</html>

and my app.js file:

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

myApp.controller('mainController', function($scope) {
    console.log($scope);
});

I'm trying to console $scope but I'm getting the following error:

GET file:///Users/carlosgrijalva/Code/Angular/Code-The-Scope->Service/Starter/code.angularjs.org/1.3.0-rc.1/angular.min.js >net::ERR_FILE_NOT_FOUND

The cdn link seems to be working fine on my browser and this is basically the template provided by the tutorial. I can't really figure out what it's not working. Anyone have any ideas?

Upvotes: 0

Views: 942

Answers (1)

Joseph Cho
Joseph Cho

Reputation: 4214

Try updating your script tag to be:

<script src="https://code.angularjs.org/1.3.0-rc.1/angular.min.js"></script>

If you provide just forwardslashes javascript will start looking through your own filepath.

Upvotes: 1

Related Questions