Giter VIP home page Giter VIP logo

angularjs-book's People

Contributors

chibicode avatar robertk-work2 avatar shyamseshadri avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

angularjs-book's Issues

change all raw.github to rawgithub

According to this

Rawgithub.com allows users to take the "Raw" versions of a Git and turn it into a URL usable in <script> tags.

Use raw.github will get this error.

Refused to execute script from 'http://raw.github.com/blueimp/jQuery-File-Upload/master/js/vendor/jquery.ui.widget.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled. 

Chapter 3 : Karma

Hello
I want use Karma. I installed it and run in sample-app root file.
Karma ask for "What is the location of your source and test files ?"
so which directory for test ?
test directory or test/spec directory ?

bug

Hello, I'm one of the readers of this book. I found that the template viewRecipe.html on page 92 was not correspond with the text content. For example, there is no ng-class in the code, which is mentioned in the text content.

the codes need to be update

I think most of the readers use express 4.0 nowadays.As we know, bodyParser and method-override have been deprecated, so It's better to update these codes in order to provide better guidance for the green hands.

Downloaded the code in Chapter 4 - get 404 error

When I go to http://localhost:9000/, I see
Loading....
New Recipe
Recipe List
In the console there is the error
Failed to load resource: the server responded with a status of 404 (Not Found)

I click on New Recipe and am able to fill out the form, but when I click on Save, I get:
POST http://localhost:9000/recipes 404 (Not Found)

Stack trace is below if that is meaningful to you.... would love to run this sample app - seems pretty important in understanding Angular.

Thanks in advance for any advice...
RB


GET http://localhost:9000/recipes 404 (Not Found) angular.min.js:96
(anonymous function) angular.min.js:96
o angular.min.js:93
l angular.min.js:92
g.(anonymous function) angular-resource.min.js:8
(anonymous function) services.js:15
$routeProvider.when.resolve.recipes controllers.js:12
d angular.min.js:26
(anonymous function) angular.min.js:79
m angular.min.js:6
e.when.then.then.b.locals angular.min.js:79
i angular.min.js:75
i angular.min.js:75
(anonymous function) angular.min.js:76
e.$eval angular.min.js:86
e.$digest angular.min.js:84
e.$apply angular.min.js:86
(anonymous function) angular.min.js:15
d angular.min.js:26
qb angular.min.js:15
jc angular.min.js:15
(anonymous function) angular.min.js:159
a angular.min.js:114
(anonymous function) angular.min.js:22
m angular.min.js:6
c

Chapter 3 : Yeoman

I cannot get this to work. I run 'grunt serve' (grunt server is deprecated) I get 'fatal error, bower components not found'.

Any help is appreciated.

Use angular without tools !

Can I use angular without any tools such as karma,yoeman or something else ?
And anybody can tell me about what phantomjs exactly do ?

chapter 1

the $index in the remove function ,which cannot define as the current index in the ng-repeat array. In the console, when i try to find out the current index, it show undefined.
why?
js:
var myApp=angular.module('app1',[]);
myApp.factory('Data', function(){//this is the set up ofthe service.

 items=[
    {id:0, name:'pen', quality:20, unitPrice:2.20},
    {id:1, name:'paper', quality:17, unitPrice:1.20},
    {id:2, name:'sticker', quality:40, unitPrice:0.10},

]
return items;
})

myApp.controller('Ctrl_1', function($scope, Data){
$scope.items=Data;
$scope.createNewItem=function (a,b,c){
var index=$scope.items.length;
index=index++;

    a=$scope.name;
    b=$scope.quality;
    c=$scope.unitPrice;

     $scope.items.push( {id:index, name:a, quality:b, unitPrice:c});

    }
 $scope.remove = function(index ){
     console.log($scope.items);
     console.log(index);//in concoel show it undefined.
    $scope.items.splice(index, 1);
    console.log($scope.items);
    }

})

myApp.controller('Ctrl_2',function($scope, Data){
$scope.items=Data;
});

html:
<!doctype html>

<title>Angular test 1</title>
create new item
  • {{item.name}}

    Quantity: {{item.quality}}
    Unit Price: {{item.unitPrice}}
    Total: {{item.unitPrice*item.quality | currency}}

    Remove
{{a.message}}
{{a.message}}
    </div>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js"></script> <script src="js/app.js"></script>

vb.net

Imports System.Data.OleDb
Public Class frm_class

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
    Try

        If txtClassNumber.Text = "" Then
            MsgBox("Fadlan ku qor numberka classka ")
            txtClassNumber.Focus()
            Exit Sub
        End If
        If txtNumberofTables.Text = "" Then
            MsgBox("Fadlan ku qor Tirada miisaska")
            txtNumberofTables.Focus()
            Exit Sub
        End If

        If txtNumberofChairs.Text = "" Then
            MsgBox("Fadlan ku qor Tirada kuraasta")
            txtNumberofChairs.Focus()
            Exit Sub
        End If
        con = New OleDbConnection(cs)
        con.Open()
        Dim cb As String = "insert into [class]  VALUES (" & txtClassNumber.Text & ",'" & txtNumberofTables.Text & "','" & txtNumberofChairs.Text & "')"
        cmd = New OleDbCommand(cb)
        cmd.Connection = con
        cmd.ExecuteReader()
        MessageBox.Show("Saved Successfully", "Record", MessageBoxButtons.OK, MessageBoxIcon.Information)

        Reset()


    Catch ex As Exception
        MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
    End Try

End Sub

Private Sub btnReset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReset.Click
    Reset()

End Sub
Sub Reset()

    txtClassNumber.Text = ""
    txtNumberofTables.Text = ""
    txtNumberofChairs.Text = ""
  
    txtClassNumber.Focus()
End Sub

Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
    End

End Sub

End Class

The Date Picker example is not working properly when currentDate has an initial value

For a live demo of the bug go to here.

In the mode, I have assigned an initial value to currentDate:

$scope.currentDate = '01/02/2020';

Now when you select a date via the data picker, currentDate is not changing anymore.


To expand, the issue seems to be that the binding more or less behaves unidirectional: when the model is changed by code external to the date picker component, the date picker is not re-rendering itself.

Chapter 4: test MultiRecipeLoader spec suggestions & fix

current github code:

  describe('MultiRecipeLoader', function() {
    var mockBackend, recipe, loader;
    // The _$httpBackend_ is the same as $httpBackend. Only written this way to
    // differentiate between injected variables and local variables
    beforeEach(inject(function(_$httpBackend_, Recipe, MultiRecipeLoader) {
      recipe = Recipe;
      mockBackend = _$httpBackend_;
      loader = MultiRecipeLoader;
    }));

    it('should load list of recipes', function() {
      mockBackend.expectGET('/recipes').respond([{id: 1}, {id: 2}]);

      var recipes;

      var promise = loader();
      promise.then(function(rec) {
        recipes = rec;
      });

      expect(recipes).toBeUndefined();

      mockBackend.flush();

      expect(recipes).toEqualData([{id: 1}, {id: 2}]);
    });
  });
  1. first I'd suggest the usage of leading and trailing underscores for all injected variables. the book is not explaining these are ignored by the injector and using this notation helps to highlight injected variables.
  2. second, I'd like to point out that the spec will fail as "loader" is the actually promise object and not a function.

my suggestion would be: (this is wrapped in a services test suite where the Recipe resource and $httpBackend mock are scoped for all individual service test suites)

var Recipe,
    $httpBackend;

  describe('MultiRecipeLoader', function(){
    var MultiRecipeLoader;
    //injector will ignore front and trailing underscore, this notation is to clarify injected variables
    //yet give the ability to write tests using variables exactly the same way the actual implementations do
    beforeEach(inject(function (_$httpBackend_, _Recipe_, _MultiRecipeLoader_) {
      Recipe = _Recipe_;
      $httpBackend = _$httpBackend_;
      MultiRecipeLoader = _MultiRecipeLoader_;
    }));

    it('should load a list of recipes', function () {
      $httpBackend.expectGET('/recipes').respond([{id:1}, {id:2}]);

      var recipes;
      var promise = MultiRecipeLoader;
      promise.then(function(rec){
        recipes = rec;
      });

      expect(recipes).toBeUndefined();

      $httpBackend.flush();

      expect(recipes).toEqualData([{id:1},{id:2}]);
    });

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.