Angular & ionic项目小白总结一些踩过的坑

最近的一些很蠢很蠢的坑~~~


angular http-server采用ctrl+z关闭之后不能成功启动

原因是ctrlc才能正确关闭。ctrl+z没有正确关闭


ionic run android 报错

Error: No emulator images (avds) found.

1. Download desired System Image by running: /Users/lulifei/develop/android-sdk-macosx/tools/android sdk

2. Create an AVD by running: /Users/lulifei/develop/android-sdk-macosx/tools/android avd

HINT: For a faster emulator, use an Intel System Image and install the HAXM device driver

找不到设备

将USB试模式设置为媒体设备就好


error:[$compile:ctreq] http://errors.angularjs.org/1.5.9/$compile/ctreq?p0=stTable&p1=stSearch

    at http://localhost:8888/lib/js/main.min.js:2:412

    at X (http://localhost:8888/lib/js/main.min.js:3:2101)

    at p (http://localhost:8888/lib/js/main.min.js:2:31411)

    at a (http://localhost:8888/lib/js/main.min.js:2:27317)

    at a (http://localhost:8888/lib/js/main.min.js:2:27334)

    at a (http://localhost:8888/lib/js/main.min.js:2:27334)

    at a (http://localhost:8888/lib/js/main.min.js:2:27334)

    at a (http://localhost:8888/lib/js/main.min.js:2:27334)

    at p (http://localhost:8888/lib/js/main.min.js:2:31316)

    at a (http://localhost:8888/lib/js/main.min.js:2:27317)

(anonymous) @ main.min.js:3

错误

没有在表格上加st-table="rowCollection"


smarttablesearch的时候输入内容不识别

原因:

加入st-table="displayedCollection" st-safe-src="rowCollection"

其中,"displayedCollection”是在html里的,"rowCollection”是在js里赋值的

注意对齐head和body的元素


登录报错404 not found

cordova plugin remove cordova-plugin-whitelist

then renstalled it

cordova plugin add cordova-plugin-whitelist


 BarcodeScanner is not defined;

参照网上教程:

https://forum.ionicframework.com/t/cannot-read-property-barcodescanner-of-undefined-cordova/5290/3

项目路径下运行

cordova plugin add https://github.com/wildabeast/BarcodeScanner.git


ReferenceError: baidu_location is not defined

    at Scope.$scope.tirarFoto (file:///android_asset/www/js/lotsearch.js:21:6)

    at fn (eval at  

安装以下插件

http://blog.csdn.net/zhang_shi_yu920/article/details/51469329


Uncaught TypeError: n.go is not a function

    at Object.success (dashboard.min.js:3)

    at fire (jquery-latest.js:3119)

    at Object.fireWith [as resolveWith] (jquery-latest.js:3231)

    at done (jquery-latest.js:9275)

    at XMLHttpRequest.callback (jquery-latest.js:9685)

$cookieStore’controller里的去掉,即可识别


不识别QRCode

TypeError: jQuery(...).qrcode is not a function

    at r (http://localhost:8888/js/dashboard.min.js:13:54)

    at new QRCtrl 

换插件;

载入的时候没用画出来;设置ng-init


bad request

没有解析成json

data: JSON.stringify(data),

parseInt

parseFloat


文件上传upload不识别

安装bower install ng-file-upload —save

参考网址

https://github.com/danialfarid/ng-file-upload


bower install和npm install安装插件的时候

在项目根目录下采用bower install npm install安装到项目的不同位置,

采用bower install安装到bower_compents中,

采用nam install安装到node_modules中,

但是在项目中引用的时候安装在node_modules中不能找到

需要安装到bower_compents中。

解决:

echo $PATH

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

vi /etc/profile 

sudo vi ~/.bashrc

Password:

$ sudo vi ~/.bashrc

$ vi .bash_profile

$ npm config get globalconfig

/usr/local/etc/npmrc

/usr/local/lib/node_modules

export NODE_PATH=/usr/lib/node_modules:$NODE_PATH





参考:

[1]http://stackoverflow.com/questions/33248577/trying-to-setup-sort-on-a-table-using-smart-table-in-angularjs

[2]https://forum.ionicframework.com/t/cannot-read-property-barcodescanner-of-undefined-cordova/5290/3

[3]http://blog.csdn.net/zhang_shi_yu920/article/details/51469329

[4]https://github.com/danialfarid/ng-file-upload


你可能感兴趣的:(angular)