GithubHelp home page GithubHelp logo

angularjs-sample's People

Contributors

sinmetal avatar teyosh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

angularjs-sample's Issues

Guestbookを未入力の状態でsubmitすると、AngularJSでerrorが発生する

Guetbookを未入力の状態でsubmitすると、AngularJSでerrorが発生する。
http://localhost:8080/#/guestbook/entry

コンボボックスを選択してない状態で、$scopeの内容を取得しようとしたのが原因のような気がする。
TypeError: Cannot read property 'pokemon' of undefined
at Object.$scope.submit (http://localhost:8080/script/main.js:63:46)
at y (http://code.angularjs.org/1.0.7/angular.min.js:72:251)
at Object.$get.e.$eval (http://code.angularjs.org/1.0.7/angular.min.js:88:347)
at Object.$get.e.$apply (http://code.angularjs.org/1.0.7/angular.min.js:88:454)
at HTMLFormElement.Gd.restrict (http://code.angularjs.org/1.0.7/angular.min.js:144:219)
at HTMLFormElement.x.event.dispatch (http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js:5:14113)
at HTMLFormElement.x.event.add.v.handle (http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js:5:10850)

store一覧を返すAPIを作る

store一覧を返すAPIを作る。
因みにstoreは適当に付けたので、これが何の一覧なのかは完全に謎。

Toppage作成

Toppageを作成する。

なんか適当な文言でも書いてあるページ。

controllerのminifay対策

minifayされると、controller名が圧縮されてAngularJSから見えなくなってしまうため、以下のようにcontroller名を縛る。

こんなふうにコントローラ定義しておいて
app.controller("EntryController", ['$scope', '$location', '$resource', EntryController]);

で、コントローラの名前を文字列で指定してあげればよかった気がします。
$routeProvider.when('/entry', {controller:"EntryController", templateUrl:'entry.html'});

activetab directiveのlocationpathの設定を、第一階層のみにする

今の作りだと、urlを全て見ているので、以下のようになってしまう。

url : guestbook/entry
a tag : guetbook
urlとa tagの内容が不一致なので、activeにならない。

これをactiveの状態にしたいため、第一階層のみ見るようにする。
上記の例だと、guestbook/entryなので、guestbookのみで判定したい。

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.