3 Replies - 409 Views - Last Post: 03 May 2013 - 08:19 AM

#1 WolverineX  Icon User is offline

  • New D.I.C Head

Reputation: 5
  • View blog
  • Posts: 49
  • Joined: 11-November 12

Quick question about AngularJS

Posted 03 May 2013 - 07:10 AM

According to this video "http://www.egghead.io/video/Lx7ycjC8qjE", at 2:20 to 2:50. He tried using like "label" and "alert-box", but I tried to run my code and it didn't work out for me. Here it is:

<!DOCTYPE html>
<html ng-app>
    <script src="lib/angular/angular.js"></script>
    <script src="js/controllers.js"></script>
    <div ng-app="">
        <input type="text" ng-model="data.message">
         <h1>{{ data.message + " world"}} </h1>

        <div class="{{data.message}}">Wrap me with</div>
    </div>
    <script type="text/javascript">
        
    </script>
    </body>

</html>


I am also running them on jsfiddle.net

This post has been edited by WolverineX: 03 May 2013 - 07:22 AM
Reason for edit:: Added [code] tags.


Is This A Good Question/Topic? 0
  • +

Replies To: Quick question about AngularJS

#2 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3716
  • View blog
  • Posts: 5,976
  • Joined: 08-June 10

Re: Quick question about AngularJS

Posted 03 May 2013 - 07:22 AM

Moved to the Javascript forum. This is in no way related to PHP, as far as I can see.

Also, please remember the [code] tags:

:code:

You need to go over that video again and compare your code to the code used there. Your <input> and <div> tags may be correct, but the basic structure of the page isn't even close to what he demonstrates in that video. The most significant errors in your code is the fact you are missing the <head> and <body> tags, except for the end </body> tag, which is just sitting there all alone at the bottom of the page, without a matching start tag, and you don't include the CSS file.

It doesn't matter what classes you apply to your div through this data binding stuff if the CSS code that is supposed to style them isn't included in the page.
Was This Post Helpful? 0
  • +
  • -

#3 WolverineX  Icon User is offline

  • New D.I.C Head

Reputation: 5
  • View blog
  • Posts: 49
  • Joined: 11-November 12

Re: Quick question about AngularJS

Posted 03 May 2013 - 07:36 AM

Hi, thanks. But it still didn't work. Also he didn't mention anything about CSS in the video.
Was This Post Helpful? 0
  • +
  • -

#4 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3716
  • View blog
  • Posts: 5,976
  • Joined: 08-June 10

Re: Quick question about AngularJS

Posted 03 May 2013 - 08:19 AM

Show us the updated code. - "still didn't work" has no debugging value whatsoever.

The code he shows in the video includes a <link> tag to the CSS file. He's obviously not going to go over every basic concept in that video, like the need to include the CSS styles you are applying. That would take forever, and the goal of the video is to demonstrate the use of his JS library, not to teach the basics. It's assumed that you are proficient enough with HTML, CSS and JS to know that in order for a class to have an effect on the way an element looks, that class has to have CSS styles associated with it.

If you are foggy on those kind of concepts, it would be a good idea to go over them before you start on more advanced stuff like this. You know what happens when people build on unreliable foundations.
Was This Post Helpful? 2
  • +
  • -

Page 1 of 1