小编EvW*_*ill的帖子

输入文本输入后,ng-model不再更新

我是AngularJS的新手,我遇到了一个问题,我无法解决,在stackoverflow上有一个类似的问题,但它似乎没有帮助我.我基本上有一个通过ng-click更新的表单,但是一旦我在任何文本框中输入文本,这些文本框就不再更新了.

这是我的HTML

Edit Course:
<li ng-repeat="course in courses">
  <p>
    <a ng-click="Edit_Course(course.id)">{{course.course_name}}</a>
  </p>
</li>
<div ng-show="showedit == 1">
  <form novalidate ng-submit="edit_course()" class="simple-form">
    <label for="form_course_name">Course</label>
      <input type="text" id="form_course_name" ng-model="edit_course_name">
    <label for="form_par">Par</label>
      <input type="text" id="form_par" ng-model="edit_course_par">
    <label for="form_course_location">Course Location</label>
      <input type="text" id="form_course_location" ng-model="edit_course_location">
     <input type="submit" id="submit" value="Edit Course" />
   </form>
</div>
Run Code Online (Sandbox Code Playgroud)



这是我的功能,当有人点击链接时调用该功能

$scope.Edit_Course = function (id) {
    var course = {
        'course_id' : id
    };

    $http({method: "POST", url: "http://www.dgcharts.com/editcourse", data: course})
    .success(function(data, status, headers, config){

      thecourse = data["course"];
      $scope.edit_course_name = thecourse.course_name;
      $scope.edit_course_par = …
Run Code Online (Sandbox Code Playgroud)

html javascript angularjs angular-ngmodel

29
推荐指数
1
解决办法
6万
查看次数

如何测试这个类或重写它是可测试的?phpspec

这个类非常简单,如果有空间,它会在字符串中添加一个twitter标签.Twitter只允许140个字符(网址减去23).因此,如果有一个空间,则标签会不断添加.

我不认为它100%按预期工作,但这与我在下面的问题无关.

class Hashtags {

private $url_character_count = 23;
private $characters_allowed = 140;

public function __construct(Article $article)
{
    $this->article = $article;
    $this->characters_remaining = $this->characters_allowed - $this->url_character_count;
}

public function createHashtagString()
{
        $hashtags = '';
        $hashtags .= $this->addEachNodeHashtag();
        $hashtags .= $this->addHashtagIfSpace($this->article->topic_hashtag);
        $hashtags .= $this->addHashtagIfSpace($this->article->pubissue_hashtag);
        $hashtags .= $this->addHashtagIfSpace($this->article->subject_area_hashtag);
        $hashtags .= $this->addHashtagIfSpace('#aviation');
        return $hashtags;
}

private function addEachNodeHashtag()
{
    //Returns a hashtag or calls hashtagString() if it is a comma separated list
}

private function hashtagString()
{
    //Explodes a comma seperated string of …
Run Code Online (Sandbox Code Playgroud)

php testing phpspec

2
推荐指数
1
解决办法
618
查看次数

标签 统计

angular-ngmodel ×1

angularjs ×1

html ×1

javascript ×1

php ×1

phpspec ×1

testing ×1