Unidentified ng-controller issue in AngularJS app

I’m trying some initial stuff to get used to AngularJS. My current source is SoloLearn. I tried to recreate their app, which adds +1 to a counter when a button is clicked.

I have tried checking the code from their app, and I’ve also copied and pasted their work onto my HTML file and it still doesn’t work, I tried an online tool for ascii diffs and my code should be identical, yet my inspector yields this:

at angular.js:38
at angular.js:10839
at ba (angular.js:9931)
at n (angular.js:9701)
at g (angular.js:9055)
at g (angular.js:9058)
at g (angular.js:9058)
at angular.js:8920
at angular.js:1919
at m.$eval (angular.js:18161)

I checked the site and as I understand, my code should still be working, yet it’s not.

My code:

<div ng-app="MyApp" ng-controller="myCtrl">
    <button ng-click="count=count+1">Click me!</button>
    <p> {{count}} </p>
    var app = angular.module('MyApp',[])
    app.controller('myCtrl', function($scope) {

Their code:

<div ng-app="myApp" ng-controller="clickCounter">
        <button ng-click="count=count+1">Click me!</button>
        <p>{{ count }}</p>
    var app = angular.module('myApp', []);
    app.controller('clickCounter', function($scope) {
        $scope.count = 0;

Thanks for the help!

EDIT: My code on GitHub (it has some other garbage in it as well)

The OG code on GitHub which is working as should be!

Source: AngularJS