我正在运行AngularJS app.

我之前在本地跑过,我可以发布到本地服务器.

现在我在实时服务器上尝试它,我收到以下错误:

Unable to create Reservation.

只要无法发布到服务器,就会从create.PHP页面发布此错误.

有人知道我的代码有什么问题吗?

create.PHP页面

<?PHP
// required headers
header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json; charset=UTF-8");
header("Access-Control-Allow-Methods: POST");
header("Access-Control-Max-Age: 3600");
header("Access-Control-Allow-Headers: Content-Type,Access-Control-Allow-Headers,Authorization,X-Requested-With");

// get database connection
include_once '../config/database.PHP';

// instantiate reservation object
include_once '../objects/reserve.PHP';

$database = new Database();
$db = $database->getConnection();

$reservation = new Reservation($db);

// get posted data
$data = json_decode(file_get_contents("PHP://input"));

// set product property values
$reservation->name = $data->name;
$reservation->eMail = $data->eMail;
$reservation->phoneNumber = $data->phoneNumber;
$reservation->colorScooter = $data->colorScooter;
$reservation->amountScooters = $data->amountScooters;
$reservation->inputDate = $data->inputDate;
$reservation->returnDate = $data->returnDate;
$reservation->category_id = $data->category_id;
$reservation->created = date('Y-m-d H:i:s');

// create the reservation
if($reservation->create()){
    echo '{';
        echo '"message": "Reservation was created."';
    echo '}';
}

// if unable to create the reservation,tell the user
else{
    echo '{';
        echo '"message": "Unable to create Reservation."';
    echo '}';
}
?>

编辑02-08-18

它似乎没有设置属性值.

// set product property values
$reservation->name = $data->name;
$reservation->eMail = $data->eMail;
$reservation->phoneNumber = $data->phoneNumber;
$reservation->colorScooter = $data->colorScooter;
$reservation->amountScooters = $data->amountScooters;
$reservation->inputDate = $data->inputDate;
$reservation->returnDate = $data->returnDate;
$reservation->category_id = $data->category_id;
$reservation->created = date('Y-m-d H:i:s');

我在运行create.PHP live vs local时打开这个

本地

<br />
<b>Notice</b>:  Trying to get property of non-object in <b>C:\xampp\htdocs\api2\reserve\update.PHP</b> on line <b>24</b><br />
<br />
<b>Notice</b>:  Trying to get property of non-object in <b>C:\xampp\htdocs\api2\reserve\update.PHP</b> on line <b>27</b><br />
<br />
<b>Notice</b>:  Trying to get property of non-object in <b>C:\xampp\htdocs\api2\reserve\update.PHP</b> on line <b>28</b><br />
<br />
<b>Notice</b>:  Trying to get property of non-object in <b>C:\xampp\htdocs\api2\reserve\update.PHP</b> on line <b>29</b><br />
<br />
<b>Notice</b>:  Trying to get property of non-object in <b>C:\xampp\htdocs\api2\reserve\update.PHP</b> on line <b>30</b><br />
<br />
<b>Notice</b>:  Trying to get property of non-object in <b>C:\xampp\htdocs\api2\reserve\update.PHP</b> on line <b>31</b><br />
<br />
<b>Notice</b>:  Trying to get property of non-object in <b>C:\xampp\htdocs\api2\reserve\update.PHP</b> on line <b>32</b><br />
<br />
<b>Notice</b>:  Trying to get property of non-object in <b>C:\xampp\htdocs\api2\reserve\update.PHP</b> on line <b>33</b><br />
<br />
<b>Notice</b>:  Trying to get property of non-object in <b>C:\xampp\htdocs\api2\reserve\update.PHP</b> on line <b>34</b><br />
<br />
<b>Notice</b>:  Trying to get property of non-object in <b>C:\xampp\htdocs\api2\reserve\update.PHP</b> on line <b>35</b><br />
{"message": "Unable to update reservation."}

生活

{"message": "Unable to update reservation."}

它似乎在现场它不寻找房产价值

在HP 7.0上运行(7.0.28)

添加:

ini_set(‘display_errors’,1);
ini_set(‘display_startup_errors’,1);
使用error_reporting(E_ALL);

现在显示以下内容

Trying to get property of non-object in /var/www/vhosts/128/313118/webspace/httpdocs/e-citywheels.com/new/api2/reserve/create.PHP on line 32

编辑增加了RESERVE.PHP

<?PHP
class Reservation{

    // database connection and table name
    private $conn;
    private $table_name = "reservations";

    // object properties
    public $id;
    public $name;
    public $eMail;
    public $phoneNumber;
    public $colorScooter;
    public $amountScooters;
    public $inputDate;
    public $returnDate;
    public $category_name;
    public $created;

    // constructor with $db as database connection
    public function __construct($db){
        $this->conn = $db;
    }

    // read reservations
    function read(){

        // select all query
        $query = "SELECT
                    c.name as category_name,p.id,p.name,p.eMail,p.phoneNumber,p.colorScooter,p.amountScooters,p.inputDate,p.returnDate,p.category_id,p.created
                FROM
                    " . $this->table_name . " p
                    LEFT JOIN
                        categories c
                            ON p.category_id = c.id
                ORDER BY
                    p.created DESC";

        // prepare query statement
        $stmt = $this->conn->prepare($query);

        // execute query
        $stmt->execute();

        return $stmt;
    }
    // create product
    function create(){

        // query to insert record
        $query = "INSERT INTO
                    " . $this->table_name . "
                SET
                    name=:name,eMail=:eMail,phoneNumber=:phoneNumber,colorScooter=:colorScooter,amountScooters=:amountScooters,inputDate=:inputDate,returnDate=:returnDate,category_id=:category_id,created=:created";

        // prepare query
        $stmt = $this->conn->prepare($query);

        // sanitize
        $this->name=htmlspecialchars(strip_tags($this->name));
        $this->eMail=htmlspecialchars(strip_tags($this->eMail));
        $this->phoneNumber=htmlspecialchars(strip_tags($this->phoneNumber));
        $this->colorScooter=htmlspecialchars(strip_tags($this->colorScooter));
        $this->amountScooters=htmlspecialchars(strip_tags($this->amountScooters));
        $this->inputDate=htmlspecialchars(strip_tags($this->inputDate));
        $this->inputDate=htmlspecialchars(strip_tags($this->returnDate));
        $this->category_id=htmlspecialchars(strip_tags($this->category_id));
        $this->created=htmlspecialchars(strip_tags($this->created));

        // bind values
        $stmt->bindParam(":name",$this->name);
        $stmt->bindParam(":eMail",$this->eMail);
        $stmt->bindParam(":phoneNumber",$this->phoneNumber);
        $stmt->bindParam(":colorScooter",$this->colorScooter);
        $stmt->bindParam(":amountScooters",$this->amountScooters);
        $stmt->bindParam(":inputDate",$this->inputDate);
        $stmt->bindParam(":returnDate",$this->returnDate);
        $stmt->bindParam(":category_id",$this->category_id);
        $stmt->bindParam(":created",$this->created);

        // execute query
        if($stmt->execute()){
            return true;
        }

        return false;

    }
    // used when filling up the update product form
    function readOne(){

        // query to read single record
        $query = "SELECT
                    c.name as category_name,p.created
                FROM
                    " . $this->table_name . " p
                    LEFT JOIN
                        categories c
                            ON p.category_id = c.id
                WHERE
                    p.id = ?
                LIMIT
                    0,1";

        // prepare query statement
        $stmt = $this->conn->prepare( $query );

        // bind id of product to be updated
        $stmt->bindParam(1,$this->id);

        // execute query
        $stmt->execute();

        // get retrieved row
        $row = $stmt->fetch(PDO::FETCH_ASSOC);

        // set values to object properties
        $this->name = $row['name'];
        $this->eMail = $row['eMail'];
        $this->phoneNumber = $row['phoneNumber'];
        $this->colorScooter = $row['colorScooter'];
        $this->amountScooters = $row['amountScooters'];
        $this->inputDate = $row['inputDate'];
        $this->returnDate = $row['returnDate'];
        $this->category_id = $row['category_id'];
        $this->category_name = $row['category_name'];
    }

    // update the product
    function update(){

        // update query
        $query = "UPDATE
                    " . $this->table_name . "
                SET
                    name = :name,eMail = :eMail,phoneNumber = :phoneNumber,colorScooter = :colorScooter
                    amountScooters = :amountScooters,inputDate = :inputDate,returnDate = :returnDate,category_id = :category_id
                WHERE
                    id = :id";

        // prepare query statement
        $stmt = $this->conn->prepare($query);

        // sanitize
        $this->name=htmlspecialchars(strip_tags($this->name));
        $this->eMail=htmlspecialchars(strip_tags($this->eMail));
        $this->phoneNumber=htmlspecialchars(strip_tags($this->phoneNumber));
        $this->colorScooter=htmlspecialchars(strip_tags($this->colorScooter));
        $this->amountScooters=htmlspecialchars(strip_tags($this->amountScooters));
        $this->inputDate=htmlspecialchars(strip_tags($this->inputDate));
        $this->inputDate=htmlspecialchars(strip_tags($this->returnDate));
        $this->category_id=htmlspecialchars(strip_tags($this->category_id));
        $this->id=htmlspecialchars(strip_tags($this->id));





        // bind new values
        $stmt->bindParam(":name",$this->returnDate);
        $stmt->bindParam(':category_id',$this->category_id);
        $stmt->bindParam(':id',$this->id);

        // execute the query
        if($stmt->execute()){
            return true;
        }

        return false;
    }

    // delete the product
    function delete(){

        // delete query
        $query = "DELETE FROM " . $this->table_name . " WHERE id = ?";

        // prepare query
        $stmt = $this->conn->prepare($query);

        // sanitize
        $this->id=htmlspecialchars(strip_tags($this->id));

        // bind id of record to delete
        $stmt->bindParam(1,$this->id);

        // execute query
        if($stmt->execute()){
            return true;
        }

        return false;

    }

    // search products
    function search($keywords){

        // select all query
        $query = "SELECT
                    c.name as category_name,p.created
                FROM
                    " . $this->table_name . " p
                    LEFT JOIN
                        categories c
                            ON p.category_id = c.id
                WHERE
                    p.name LIKE ? OR p.description LIKE ? OR c.name LIKE ?
                ORDER BY
                    p.created DESC";

        // prepare query statement
        $stmt = $this->conn->prepare($query);

        // sanitize
        $keywords=htmlspecialchars(strip_tags($keywords));
        $keywords = "%{$keywords}%";

        // bind
        $stmt->bindParam(1,$keywords);
        $stmt->bindParam(2,$keywords);
        $stmt->bindParam(3,$keywords);

        // execute query
        $stmt->execute();

        return $stmt;
    }

    // read products with pagination
    public function readPaging($from_record_num,$records_per_page){

        // select query
        $query = "SELECT
                    c.name as category_name,p.created
                FROM
                    " . $this->table_name . " p
                    LEFT JOIN
                        categories c
                            ON p.category_id = c.id
                ORDER BY p.created DESC
                LIMIT ?,?";

        // prepare query statement
        $stmt = $this->conn->prepare( $query );

        // bind variable values
        $stmt->bindParam(1,$from_record_num,PDO::ParaM_INT);
        $stmt->bindParam(2,$records_per_page,PDO::ParaM_INT);

        // execute query
        $stmt->execute();

        // return values from database
        return $stmt;
    }

    // used for paging products
    public function count(){
        $query = "SELECT COUNT(*) as total_rows FROM " . $this->table_name . "";

        $stmt = $this->conn->prepare( $query );
        $stmt->execute();
        $row = $stmt->fetch(PDO::FETCH_ASSOC);

        return $row['total_rows'];
    }

}

已添加11-08-2018

添加var_dump($product);结果显示变量$product确实返回表,$data实际上是问题所在.

var_dump的结果($product);

["table_name":"Product":private]=>
  string(8) "products"
  ["id"]=>
  NULL
  ["name"]=>
  NULL
  ["email"]=>
  NULL
  ["phone"]=>
  NULL
  ["amount"]=>
  NULL
  ["description"]=>
  NULL
  ["pickup"]=>
  NULL
  ["back"]=>
  NULL
  ["category_id"]=>
  NULL
  ["category_name"]=>
  NULL
  ["created"]=>
  NULL

Current status

如果我打开create.PHP文件,它确实会创建一个产品,但如果我使用该表单,我会收到错误无法创建产品.

此外,当我打开create.PHP文件时,我收到以下错误消息:

<br />
<b>Notice</b>:  Trying to get property of non-object in <b>C:\xampp\htdocs\api\product\create.PHP</b> on line <b>37</b><br />
<br />
<b>Notice</b>:  Trying to get property of non-object in <b>C:\xampp\htdocs\api\product\create.PHP</b> on line <b>38</b><br />
<br />
<b>Notice</b>:  Trying to get property of non-object in <b>C:\xampp\htdocs\api\product\create.PHP</b> on line <b>39</b><br />
<br />
<b>Notice</b>:  Trying to get property of non-object in <b>C:\xampp\htdocs\api\product\create.PHP</b> on line <b>40</b><br />
<br />
<b>Notice</b>:  Trying to get property of non-object in <b>C:\xampp\htdocs\api\product\create.PHP</b> on line <b>41</b><br />
<br />
<b>Notice</b>:  Trying to get property of non-object in <b>C:\xampp\htdocs\api\product\create.PHP</b> on line <b>42</b><br />
<br />
<b>Notice</b>:  Trying to get property of non-object in <b>C:\xampp\htdocs\api\product\create.PHP</b> on line <b>43</b><br />
<br />
<b>Notice</b>:  Trying to get property of non-object in <b>C:\xampp\htdocs\api\product\create.PHP</b> on line <b>44</b><br />

它似乎无法找到“名称”属性.

我有这个想法导致这个问题,

// create product
factory.createProduct = function($scope){
    return $http({
        method: 'POST',data: {
            'name' : $scope.name,'email' : $scope.email,'phone' : $scope.phone,'amount' : $scope.amount,'description' : $scope.description,'pickup' : $scope.pickup,'back' : $scope.back,'category_id' : 1
        },url: 'http://localhost/api/product/create.PHP'

    });
};

我的控制器

// create new product
$scope.createProduct = function(){

    productsFactory.createProduct($scope).then(function successCallback(response){

        // tell the user new product was created
        $scope.showToast(response.data.message);

        // refresh the list
        $scope.readProducts();

        // close dialog
        $scope.cancel();

        // remove form values
        $scope.clearProductForm();

    },function errorCallback(response){
        $scope.showToast("Unable to create record.");
    });
}

product.PHP

// create product
function create(){

    // query to insert record
    // $query = "INSERT INTO " . $this->table_name . 
    // "(name,email,phone,amount,description,pickup,back,created,modified)" .
    // " VALUES(:name,:email,:phone,:amount,:description,:pickup,:back,:created,:modified)";

    $query = "INSERT INTO
                " . $this->table_name . "
            SET
                name=:name,email=:email,phone=:phone,amount=:amount,description=:description,pickup=:pickup,back=:back,created=:created";

    // prepare query
    $stmt = $this->conn->prepare($query);

    // sanitize
    $this->name=htmlspecialchars(strip_tags($this->name));
    $this->email=htmlspecialchars(strip_tags($this->email));
    $this->phone=htmlspecialchars(strip_tags($this->phone));
    $this->amount=htmlspecialchars(strip_tags($this->amount));
    $this->description=htmlspecialchars(strip_tags($this->description));
    $this->pickup=htmlspecialchars(strip_tags($this->pickup));
    $this->back=htmlspecialchars(strip_tags($this->back));
    $this->category_id=htmlspecialchars(strip_tags($this->category_id));
    $this->created=htmlspecialchars(strip_tags($this->created));

    // bind values
    $stmt->bindParam(":name",$this->name);
    $stmt->bindParam(":email",$this->email);
    $stmt->bindParam(":phone",$this->phone);
    $stmt->bindParam(":amount",$this->amount);
    $stmt->bindParam(":description",$this->description);
    $stmt->bindParam(":pickup",$this->pickup);
    $stmt->bindParam(":back",$this->back);
    $stmt->bindParam(":category_id",$this->category_id);
    $stmt->bindParam(":created",$this->created);

    // execute query
    if($stmt->execute()){
        return true;
    }

    return false;

}

Create.PHP

<?PHP


// required headers
header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json; charset=UTF-8");
header("Access-Control-Allow-Methods: POST");
header("Access-Control-Max-Age: 3600");
header("Access-Control-Allow-Headers: Content-Type,X-Requested-With");

// get database connection
include_once '../config/database.PHP';

// instantiate product object
include_once '../objects/product.PHP';

$database = new Database();
$db = $database->getConnection();

$product = new Product($db);

// get posted data
$data = json_decode(file_get_contents("PHP://input"));

echo $data;

var_dump($data);

var_dump($product);


print_r($data);

var_dump($product->name);

// set product property values
$product->name = $data->name;
$product->email = $data->email;
$product->phone = $data->phone;
$product->amount = $data->amount;
$product->description = $data->description;
$product->pickup = $data->pickup;
$product->back = $data->back;
$product->category_id = $data->category_id;
$product->created = date('Y-m-d H:i:s');



var_dump($product->name);
var_dump($data->name);

echo is_array($product->name) ? 'Array' : 'not an Array';

echo json_last_error();
// create the product
if($product->create()){
    echo '{';
        echo '"message": "Product was created."';
    echo '}';
}

// if unable to create the product,tell the user
else{
    echo '{';
        echo '"message": "Unable to create product."';

    echo '}';
}


?>

更新08-12-2018

运行createproduct()会将其发布到create.PHP中

我用谷歌浏览器的检查员网络选项卡检查了它.

{name: "test",email: "test",phone: "test",amount: "test",description: "test",pickup: "test",…}
amount
:
"test"
back
:
"test"
description
:
"test"
email
:
"test"
name
:
"test"
phone
:
"test"
pickup
:
"test"

它还返回代码:200

根据这个link的意思是:

200好的
此响应代码表示请求成功.

201创建
这表示请求成功并创建了资源.它用于确认PUT或POST请求的成功.

它似乎没有创建新资源,也没有发布任何内容.

为什么使用PHP://输入?您是否有理由不使用$_POST访问发布的数据?如果POST-Request命中PHP,则会创建全局关联数组$_POST.每个索引都将匹配表单中的一个名称属性并包含其值.

显示的错误可能来自这种方法,因为PHP://输入可以是任何东西,所以$data可以.如果是这种情况,您尝试从实际上不是对象的对象中分配值($reservation-> name = $data-> name;).

// get posted data
$data = json_decode(file_get_contents("PHP://input"));

// set product property values
$reservation->name = $data->name;
$reservation->eMail = $data->eMail;
$reservation->phoneNumber = $data->phoneNumber;
$reservation->colorScooter = $data->colorScooter;
$reservation->amountScooters = $data->amountScooters;
$reservation->inputDate = $data->inputDate;
$reservation->returnDate = $data->returnDate;
$reservation->category_id = $data->category_id;
$reservation->created = date('Y-m-d H:i:s');

阐明$data的数据类型,并确保无论如何都保持不变. (尝试使用var_dump而不是echo或print_r,授予其他信息)

无法使用AngularJS和PHP发布的更多相关文章

  1. iOS 10 Safari问题在DOM中不再包含元素

    使用此链接,您可以重现该错误.https://jsfiddle.net/pw7e2j3q/如果您点击元素并从dom中删除它,然后单击链接测试.你应该看到旧的元素弹出选择.是否有一些黑客来解决这个问题?解决方法我能够重现这个问题.问题是,每当您尝试删除其更改事件上的选择框时,iOS10都无法正确解除对选择框的绑定.要解决此问题,您需要将代码更改事件代码放在具有一些超时

  2. ios – 有没有办法针对存档版本(.ipa)运行XCTest(UI)?

    要么我们可以单独构建和测试,以便我们可以先构建并在以后对该构建进行测试吗?

  3. ios app如何“知道”运行单元测试

    我知道我可以用xcodebuild开始我的应用程序的单元测试,但我想知道是什么告诉应用程序在启动期间运行测试,它是一个发送到应用程序的特殊参数,还是以不同的方式编译以运行测试?

  4. ios – 如何在Swift中正确转换为子类?

    我有一个带有许多不同单元格的UITableView,基于数据源内容数组中的内容,它们应该显示自定义内容.在这里我得到了错误UITableViewCell没有属性customLabelQuestionTableViewCell有哪些.我的演员到QuestionTableViewCell有什么问题?解决方法问题不是你的演员,而是你的细胞宣言.您将其声明为可选的UITableViewCell,并且该声明

  5. xcode – 添加OCMock会导致Test启动主应用程序而不是运行测试

    我正在尝试将Ocmock添加到我现有的Cocoa项目中,但我遇到了一个我没有看到其他人覆盖的奇怪问题.我最终将它分离到以下内容:如果我只是将Ocmock.framework引用添加到我的项目中(即以某种方式将其拖到LinkBinaryWithLibraries构建阶段),当我运行测试时,真正的应用程序将被启动.没有Ocmock,输出正常:使用Ocmock框架链接(部分输出):此后,其他应用程序输出

  6. Xcode:用于条件DEBUG / TEST代码的预处理器宏

    我在我的代码(例如AppDelegate.m)中有不应该为单元测试编译的部分,例如当您在创建新项目时选择“添加单元测试”时,目标是由Xcode设置的.在项目文件中,我已将标志CONfigURATION_TESTS添加到内置目标的MyAppTests的预处理器宏中,但未添加到MyApp目标.这是我发现的许多帖子中的建议方式.但是这不起作用,因为(我猜)MyAppTests目标将MyApp目标作为依赖

  7. ios – 嵌套递归函数

    我试图做一个嵌套递归函数,但是当我编译时,编译器崩溃.这是我的代码:编译器记录arehere解决方法有趣的…它似乎也许在尝试在定义之前捕获到内部的引用时,它是bailing?以下修复它为我们:当然没有嵌套,我们根本没有任何问题,例如以下工作完全如预期:我会说:报告!

  8. ios – 在Restkit 0.2中为给定的类添加两个请求描述符

    我需要从User类中提供两种不同类型的POST.我试图制作两个请求描述符并将其添加到我的对象管理器,但是我收到错误“Cannotaddarequestdescriptorforthesameobjectclassasanexistingrequestdescriptor.”我的代码有没有人知道如何解决这个问题,而不需要为这些请求创建一个单独的类?任何帮助是赞赏.谢谢.解决方法您可以使用动态映射来切

  9. 从iOS应用程序发送帖子到PHP脚本不工作…简单的解决方案就像

    我之前已经做了好几次了但是由于某些原因我无法通过这个帖子…我尝试了设置为_POST且没有的变量的PHP脚本……当它们未设置为发布时它工作精细.这是我的iOS代码:这里是PHP的一大块,POST变量不在正确的位置?我想这对于更有经验的开发人员来说是一个相当简单的答案,感谢您的帮助!解决方法$_POST是一个数组,而不是一个函数.您需要使用方括号来访问数组索引:

  10. ios – Swift 3 – 将文件夹从主包复制到文档目录

    我的主要包中包含文件夹,我想在首次启动应用程序时将它们复制/剪切到文档目录,以便从那里访问它们.我见过一些例子,但他们都在Obj-C中,我正在使用Swift3.我怎么能这样做?解决方法我设法使用2个功能:

随机推荐

  1. Angular2 innerHtml删除样式

    我正在使用innerHtml并在我的cms中设置html,响应似乎没问题,如果我这样打印:{{poi.content}}它给了我正确的内容:``但是当我使用[innerHtml]=“poi.content”时,它会给我这个html:当我使用[innerHtml]时,有谁知道为什么它会剥离我的样式Angular2清理动态添加的HTML,样式,……

  2. 为Angular根组件/模块指定@Input()参数

    我有3个根组件,由根AppModule引导.你如何为其中一个组件指定@input()参数?也不由AppModalComponent获取:它是未定义的.据我所知,你不能将@input()传递给bootstraped组件.但您可以使用其他方法来做到这一点–将值作为属性传递.index.html:app.component.ts:

  3. angular-ui-bootstrap – 如何为angular ui-bootstrap tabs指令指定href参数

    我正在使用角度ui-bootstrap库,但我不知道如何为每个选项卡指定自定义href.在角度ui-bootstrap文档中,指定了一个可选参数select(),但我不知道如何使用它来自定义每个选项卡的链接另一种重新定义问题的方法是如何使用带有角度ui-bootstrap选项卡的路由我希望现在还不算太晚,但我今天遇到了同样的问题.你可以通过以下方式实现:1)在控制器中定义选项卡href:2)声明一个函数来改变控制器中的散列:3)使用以下标记:我不确定这是否是最好的方法,我很乐意听取别人的意见.

  4. 离子框架 – 标签内部的ng-click不起作用

    >为什么标签标签内的按钮不起作用?>但是标签外的按钮(登陆)工作正常,为什么?>请帮我解决这个问题.我需要在点击时做出回复按钮workingdemo解决方案就是不要为物品使用标签.而只是使用divHTML

  5. Angular 2:将值传递给路由数据解析

    我正在尝试编写一个DataResolver服务,允许Angular2路由器在初始化组件之前预加载数据.解析器需要调用不同的API端点来获取适合于正在加载的路由的数据.我正在构建一个通用解析器,而不是为我的许多组件中的每个组件设置一个解析器.因此,我想在路由定义中传递指向正确端点的自定义输入.例如,考虑以下路线:app.routes.ts在第一个实例中,解析器需要调用/path/to/resourc

  6. angularjs – 解释ngModel管道,解析器,格式化程序,viewChangeListeners和$watchers的顺序

    换句话说:如果在模型更新之前触发了“ng-change”,我可以理解,但是我很难理解在更新模型之后以及在完成填充更改之前触发函数绑定属性.如果您读到这里:祝贺并感谢您的耐心等待!

  7. 角度5模板形式检测形式有效性状态的变化

    为了拥有一个可以监听其包含的表单的有效性状态的变化的组件并执行某些组件的方法,是reactiveforms的方法吗?

  8. Angular 2 CSV文件下载

    我在springboot应用程序中有我的后端,从那里我返回一个.csv文件WheniamhittingtheURLinbrowsercsvfileisgettingdownloaded.现在我试图从我的角度2应用程序中点击此URL,代码是这样的:零件:服务:我正在下载文件,但它像ActuallyitshouldbeBook.csv请指导我缺少的东西.有一种解决方法,但您需要创建一个页面上的元

  9. angularjs – Angular UI-Grid:过滤后如何获取总项数

    提前致谢:)你应该避免使用jQuery并与API进行交互.首先需要在网格创建事件中保存对API的引用.您应该已经知道总行数.您可以使用以下命令获取可见/已过滤行数:要么您可以使用以下命令获取所选行的数量:

  10. angularjs – 迁移gulp进程以包含typescript

    或者我应该使用tsc作为我的主要构建工具,让它解决依赖关系,创建映射文件并制作捆绑包?

返回
顶部